re: How would you convince your company to implement unit tests? VIEW POST

FULL DISCUSSION
 

Tests help ensure confidence in the quality of the initial version of the code as well as when it is changed in the future. Growth is a form of change. Therefore if your business is growing it will necessarily change.

Here's an example: Go and take 5 modules from your codebase that don't have tests. Write unit tests for them. I would bet a good sum of money on two outcomes: For one, you will found at least one bug. Whether it's an edge case that was previously unknown such as a missing null check or a max integer overflow or incorrect business logic: you will find something incorrect.

Two, you will find ways to improve the module's API. In an organization with several developers strong API contracts are incredibly valuable. Tests help you to think like other developers and provide an example of how you intend for the module to be used. This allows developers to be confident in each others code and unblock themselves without interrupting one another.

Edit: Not that I want to write novel here but another point... When developers start writing unit tests there is initial learning curve. Unit testing is a different way of thinking and uses different APIs. This is especially true for devs that no experience with tests. You have to message clearly to management that starting the practice has that initial cost. Additionally, be sure to look around and try multiple frameworks to be sure you are using the most efficient tools for the job. Pair programming is especially great for teaching how to write unit tests. Good luck!

code of conduct - report abuse