I don't test
If you have already been convinced to TDD, you should move to the next section. It will focus on advanced techniques and tools for making your life easier when working with tests. This part is mainly intended for those who are not using this approach and tries to advocate its usage.
Test-driven development principles
The test-driven development process, in its simplest form, consists of three steps:
- Writing automated tests for a new functionality or improvement that has not been implemented yet.
- Providing minimal code that just passes all the defined tests.
- Refactoring code to meet the desired quality standards.
The most important fact to remember about this development cycle is that tests should be written before implementation. It is not an easy task for unexperienced developers, but it is the only approach which guarantees that the code you are going to write will be testable.
For example, a developer who is asked to write a function that checks whether the given number is...