DEV Community

Discussion on: How would you convince your company to implement unit tests?

Collapse
 
scotthannen profile image
Scott Hannen • Edited

I've never personally witnessed the sort of change you're describing. At the large company where I worked one developer after another tried to explain it to us, even doing lunch trainings. No one caught on. I followed the crowd. A small part of the problem was that we confused unit testing with TDD, which makes it seem much more difficult. A bigger part was that we were ignorant and apparently loved bugs. Each of these developers gave up and moved on after a year or so.

Another developer joined, and really tried hard to sell it. He wrote lots and lots of tests. He did a lot of great work and did it at least three times faster than anyone else around him. That's conservative. At this point I got it. Still ignorant, however, I assumed that me getting it meant that everyone else did too, but it turned out that now only two of us were writing unit tests. Then he gave up and moved on.

Now it was just me. I tried really hard to sell it. Some of the managers, themselves previous developers, didn't even know what unit tests were. I showed them how I could write software that worked with very few bugs and do it faster because I always knew that a unit of code worked before committing it. Then I gave up and moved on.

I'm not saying that it can't be done just because I couldn't do it and a bunch of developers smarter than me couldn't do it (especially because it's just one company.) I just wouldn't beat your head against it too long. Unit tests are a good barometer for the health of other practices. If a team or department won't adopt unit testing then they love bugs and only a manager who gets it and enforces it has a chance of making a difference.