Some (raw) thoughts on what are the elements that give you a quality and testable code.
It’s not a full list of TODOs but some best practices that should serve you as a good baseline. If you have any suggestions, please feel free to comment.
If we agree that you must have tests in your project – The next good question is what is a good test?
- It’s FAST – The tests should run fast in order to encourage developers to use them constantly during the development process.
- Stable – The test doesn’t break often. You wish to minimize the false-positive ratio as much as you can. This is why you need ‘small’ tests that are encapsulated and give you a clear sign on what is working (or not).
- Easy to read and understand.
- Catches Bugs! When a test fails it’s most probably a bug.