Continuous Testing Manifesto
5. Unit Testing
While unit testing isn’t usually done by QA, it is a great way to improve your product’s quality. Although this takes effort, it will start paying dividends as soon as you have more than one developer or a non-trivial product.
Unit testing enables fast feedback, along with super-specific error reporting. Having good tests enables your developers to be more brutal with code changes, yet still be confident in the results.
Tip: Leverage tagging of tests. This allows developers to run subsets effectively, allowing for even faster pre-push testing.
On a non-trivial project or a non-trivial amount of developers working on the same codebase, unit-testing becomes essential to keep moving fast. Why? Developers will have to change things they didn’t write and don’t understand. Figuring out what might break without large amounts of risk, research or experience is hard.
To get greatest leverage from your unit tests, run them in the following order:
- The tests for files changed.
- The entire feature changed. Structure or tag tests by feature to help here.
- All tests. Usually this should be for every push and run via CI only, due to speed.