
Back in 2020 during the start of the first wave in the UK, before the lockdown, I gave a quick talk on testing with Pytest to a few developer’s colleagues in the office.
Few slides were titled why test and elaborated on various (more like 8) reasons for why we should write tests?
Two reasons that I believe are most important are….
Testing enables better design of the software.
Testing is not about writing tests. It is about writing a testable code.
In order to test a single unit, we need to be able to instantiate that unit standalone – without the rest of the system.
This leads to a loosely coupled code with explicit dependencies.
This leads to a better separation of concerns, and also follows the single responsibility principle
Testing enables quick feedback
Testing provides quick feedback and makes development more productive leading to more confidence when making any changes and eventually makes refactoring a codebase easier.