One of the biggest truths when it comes to developer testing is that it has to be easy!
If it’s not easy, we’ll simply don’t do it. We’ll find lots of different excuses, such as “I don’t have time”, or “Ah, I don’t really need to test this”, or “It’s not worth it”. But the thing is: no one says these things if writing the test takes just a few minutes.
- It should be easy to unit test any component of the system.
- It should be be easy to control any part of the system through, say, mocking.
- It should be easy to write integration tests, without developers having to write dozens of boilerplate lines of code.
- It should be easy to build up complex entities with a few lines of code.
- It should be easy to set up data in the database if the test requires it.
- It should be easy to write larger e2e tests if the team decides to go for it.
- It should be easy to simulate external systems and their contracts.
If you want your team to write tests all the time, you don’t need much. Just make it easy. In the next post, I’ll show you examples.