When should we run tests?
The various types of tests we discussed are intended to be run at different points during the development lifecycle.
An organization (or even a developer or a team) may have policies and preferences but, in general, the following recommendations are adopted by the industry:
- Unit tests: These tests are intended to be run during development. In other words, the developer should run them as they write the code. There are some IDEs (such as Visual Studio Enterprise) that even allow you to configure unit tests to be run in the background as you type your code! This has to be configured and used carefully as it might quickly become cumbersome. You have to, however, run them before committing your changes, and before creating or updating a pull request. Unit tests are also usually run as part of a CI/CD pipeline. For these reasons, unit tests should always be automated and are actually very easy to automate.
- Integration tests: These tests are to be...