Unit Testing is a Team Sport

TeamThis is secret unit testing tip #7. Want more? Register to the webinar.

Anyone can do unit testing. It’s a skill that needs to be learned and practiced and improved over time, and anyone can start writing unit tests today. As you and I know, it’s well worth the effort.

But is it sustainable?

Gil’s unit testing law #1: The chances of a unit testing implementation effort succeeding are directly proportional to the number of team members doing it. Or in other words: Unit testing is a team sport.

Let’s say you’ve converted to unit tests, but the other team members do not believe they worth anything.

You start writing tests for your part of the code. You commit your code with the tests, and all the tests are passing. Now it’s on to integration. Integration takes a while, well because that’s what integration like without tests. You and your partners do some modifications and finally everything works.

Well, almost everything. Your tests are failing because of the changes you made during integration. Let’s imagine what happens when the team (or even better, the ignorant team lead) finds out:

Them: “What are you doing?”

You: “I’m fixing my tests”.

Them: “Let’s see: You wrote tests before the integration. Apparently, they were not very helpful, since integration was as long as every time we do it. And now you’re fixing them. Why aren’t you working on something REALLY important?”

If this is the team’s attitude, and if you’re stubborn, you’ll continue writing and fixing tests for a while. Then you’ll stop.

Unless you have team understanding of the value of unit tests, and commitment to stick with it, you’ll eventually stop because of peer pressure.

Do you want to succeed in unit testing with your team? Get them onboard first. When they are ready, then the actual test writing begins. You’ve improved your chances by an order of magnitude.

PS This is just one topic from what I’m going to cover in my next webinar “10 secret unit testing tips to become agile.” Want to get the rest? Register to the webinar.

Gil Zilberfeld

TOP