Survey Results: How Many Developers Write Unit Tests?

Developers are told to write unit tests. But how many do? I was wondering this after receiving several comments to my last post by developers who were arguing against the practice of writing them. [1]

Development’s Dirty Secret

Do most developers write unit tests as I had been led to believe? Or is it a dirty secret in the development culture that people say they write tests but far fewer do than you would be led to believe? Naturally I was curious and did what I always do to try to satisfy my curiosity, I went to Google. Surprisingly I could not find any unit testing surveys. Granted I didn’t conduct an exhaustive search, but then again with Google I don’t usually need to. So I conducted my own survey and got a few hundred developers to take it. Here are the results:

Conclusion

The results of the survey show that indeed most developers do write unit tests. In fact it appears that most have good to great test coverage and spend a large amount of their time (for some it is quite significant) building their test suites. The one surprise for me was that only 39% of developers use the test driven development methodology. So the state of the testing culture among developers appears strong. If you are not writing unit tests yet you may want to ask yourself why you are in the minority. How do you compare to the results in this survey? Answer the survey questions by leaving a comment below.

[1]: Most of the comments were on the Hacker News and Reddit posts.

With Hubstaff you can track time, take screenshots, monitor activity levels, export reports and create invoices.

14 Day Free Trial!

Embed This Image On Your Site (copy code below):