3 ms·
I find that bugs occur when you do not fully understand all possible state combinations and edge cases. So if that is the case I try to break it down to smaller
by z3t4 10y ago
I find that bugs occur when you do not fully understand all possible state combinations and edge cases. So if that is the case I try to break it down to smaller units that are easier to comprehend. There will still be bugs though, but they are usually edge cases you didn't imagine would happen, and that's where I find testing useful, as the next person who touch the code probably will also miss that edge case.
1) Make changes
2) Manually test & run automatic tests
3) Write automatic tests for each problem/bug discovered
4) Repeat
This only works for decoupled code though. If all units are coupled you must have automatic tests of everything as no-one can comprehend exponential complexity.
- aisofteng 10y agoWhat you are describing is the process of identifying what the "units" are that should be covered by unit tests.