by gashaw on 2/9/19, 9:26 PM with 6 comments
by tcbasche on 2/10/19, 9:56 PM
- If there was a show-stopping bug in production, I like to go back and write a test that covers that case (even if it was fixed).
- However in most cases, I cover off the typical use cases and I find, as another commenter says, it's "good enough".
[1] https://hypothesis.readthedocs.io/en/latest/ [2] https://medium.com/@thomas.basche/testing-with-hypothesis-26...
by mrburton on 2/10/19, 12:46 AM
In terms of the latter, you can boil it down to two aspects.
a) Does the code function correctly given positive input? b) Does the code fail in a deterministic manner? e.g., if an age is a negative number, does it' throw an appropriate error message?
In the failure case, it can get more trickier when you start to introduce things like database persistence or API calls. In this case, you should mock out these dependencies and also set up scenarios to make sure your code also fails in a deterministic manner.
Keep in mind, what's really important is to make sure your code only doesn't what's required and nothing more. Keep things simple and no simpler. ;)
by viraptor on 2/9/19, 9:42 PM