3-minute read
Introduction
Often, especially in the early stages of projects, I kept hearing from software developers that unit tests are a burden and not needed. Here is a list of common excuses:
- our software is not mature enough to cover it with unit tests
- we don’t have enough time for that
- anyway, our solution is temporary
- our developers are senior and write bugs free code
- you spend more time updating the tests than writing the code.” and that is considered unproductive
- it doesn’t improve code quality
- it leads to unit test-oriented design 🤦♂️
From my perspective, all this reasoning against unit tests does not beat the benefits they bring in. In this article, I try to list the reasons to write unit tests. Feel free to use these arguments to convince your colleagues or managers.
Better API design
You get better API design when you think from a consumer perspective. And it’s rather hard to look at interfaces from a client/caller perspective if you are only implementing them. Let unit tests help you. Allow them to be your first clients. Using your code before finishing implementation helps to make a better and more thought-out design. With unit tests in place, you will never design API