Hacker News new | past | comments | ask | show | jobs | submit login

> While agreeing with the results of this article, I’ve found that convincing other developers of writing test with properties isn’t very easy: coming up with good properties is not always trivial.

Yes, but there's some easy targets:

Your example based tests often have some values that are supposed not to matter. You can replace those with 'arbitrary' values from your property based testing library.

Another easy test that's surprisingly powerful: just chuck 'arbitrary' input at your functions, and check that they don't crash. (Or at least, only throw the expected errors.) You can refine what 'arbitrary' means.

The implied property you are testing is that the system doesn't crash. With a lot of asserts etc in your code, that's surprisingly powerful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: