4 ms·
100% coverage means nothing. Testing every bit is easy if you ask me but coming up with edge cases takes so much time.
by darttree 4y ago
100% coverage means nothing. Testing every bit is easy if you ask me but coming up with edge cases takes so much time.
- danuker 4y agoIf the data structures that represent your edge cases are simple, maybe QuickCheck can generate your edge cases. There are equivalent libraries in a lot of languages.
- Jtsummers 4y agoHypothesis is a useful one to use in Python. Particularly with its state-based testing that lets you describe actions, preconditions, and invariants. It then exercises the program by calling a random sequence of actions and seeing if everything holds as expected. Oh, trough some sequence the "save file" option ends up not saving the file? Good to know, record that seed and track down the problem using the supplied steps which you can now repeat automatically and manually to see where the problem occurred. Maybe add another invariant after doing some research and find it is breaking earlier in the sequence. It's like having your QA/V&V/Test team doing exploratory testing but automated.
- hbrn 4y agoMost people agree that coming up with proper edge cases for unit tests is way harder than writing original code. You're not just writing code that works, you need to anticipate in what way it's going to break. That means that engineers writing unit tests should be better than engineers writing code.