Site icon DANIEL SLATER'S BLOG

How do I get my team to start unit testing

A team lead recently asked me(this genuinely happened, this isn’t just a rhetorical tick), “How do I get my team to start unit testing?“. Which sounds like a great title for a blog post…
In my opinion task of getting a team to write unit tests is really the task of getting a programmer to believe it is in their best interests to write unit tests. There are plenty of tools such as sonar qube to give technical feedback on unit coverage, but without a team buying in they won’t achieve much. It is very easy and of little benefit to do unit testing badly. So like a good salesman you need to sell them on why they will benefit from taking the extra time to unit test there already perfectly acceptable code(as they see it(if they don’t believe the code they are currently writing is acceptable then there are other problems)).
There are many reasons a person should unit test. Some reasons are noble and good, to do with doing the best job you can, for your company and your fellow professional. But that doesn’t work for everyone, so for those less nobly inclined there are also selfish reasons that are still valid.

The noble reasons:

The less than noble reasons:

So now the team are fully behind the plan and raring to go. Well probably not immediately, in teams I’ve been involved with it takes a good few months of pushing these points and including making sure that unit test percentages are reviewed, committed code is reviewed and unit tests are always required as a part of it. People need to see the benefit from doing increased testing and this may take time and energy. But over time it will happen if you’re persistent.
Exit mobile version