Most Programmers Don’t Write Tests

What percentage of programmers write automated tests on a regular basis? Has anybody attempted to answer this question through some kind of rigorous scientific analysis?

Based on my own anecdotal observation, I estimate less than 5%. Hardly anybody writes tests.

Questions for you:

  1. Do you typically write automated tests for your code?
  2. What percentage of your colleagues write as many tests as you do?
  3. When it comes to testing, do you feel your work environment is typical compared to the industry at large?

Feel free to answer other questions not listed above. And don’t forget to subscribe to my Atom feed.


1. Yes
2. 100% or I throw things.
3. No, unfortunately not. But things are looking up.

M Easter Says:

An important distinction here, that I’m interested in, is the difference between individual developers and teams.

I’d like to know ‘How many teams write tests?’

Or… ‘Has your personal testing rigor changed as you changed teams? Why or why not?’

In my experience, it is hard for a developer to write tests on a team that does not encourage that culture, even if the individual developer ‘gets it’. Kudos to those that do, and double-whammy bonus for those who can turn teams around.

Dan Lewis Says:

1. Yes.
2. 100%
3. Typical…I think the whole unit testing thing is catching on. Definitely one of the least controversial aspects of XP in particular.

1. Yes
2. 100%
3. I can’t really say, but it’s been that way everwhere I’ve worked for … well … maybe ten years?

Maybe I’ve selected the companies well? Some developers don’t write as much tests as I’d like, or test as comprehensively as I might choose, but it’s been a long time since I worked with a developer who didn’t write tests. Not that we would have let a developer continue to develop that way, I guess.

Eric Burke Says:

All you people in the 100% club aren’t making me feel very good about my job right now…maybe I need to get out more.

1. Yes
2. I’d say less han 5%
3. I gess as far as automated testing is concerned, there is no typical work environment.

Don’t feel bad about your job, from my experience, many companies focus on defining bloated development processes but fails to use well recognized practices like automated testing and continuous integration.

I found that the promotion of good development practice is a continuous effort. I think that for my part, this effor is a tax ;-) I’m willing to pay.

Sorry for the mising letters in my comment, my keyboard is acting up!

Dennis S Says:

I’ve reread the #2 question, I guess it would be allowable to say 100% if I my colleagues write zero tests like I do… Of course, that’s just my opinion, I could be wrong. (sorry Dennis Miller). Ok for real answers…

1. When I’m able to, my ability to test Swing GUI work is hampered by the framework I work within.
2. No idea.
3. More than I’d like to think. :-(

1. Yes
2. 5-10%
3. Yes, probably typical.

JR Says:

1. Yes
2. None at my current place of employment.
3. I hope not.

One thing I’ve noticed at my current job and some of my past ones are not a lot of developers are taking the time to structure their code to be tested. The current code base I inherited is littered with direct JDBC calls, making it impossible to test.

Aaron Saray Says:

There’s a distinction here to be made – those who write tests who are in control of their development time and strategies, and those who write tests – or don’t – who aren’t in control of their development strategies. Whether its a department philosophy or an analyst philosophy to write tests/ not write tests, determines a lot of times in larger coding shops whether tests will be created.

I work on a lot of legacy code that isn’t very conducive to writing test cases – that is to say… I haven’t found an easy way to write tests around it that don’t modify the existing code. With a leadership base that does not support a test based development paradigm, building such as system is nearly impossible… but I don’t think that should reflect on me.

The reason I bring this up is, although these answers may be accurate and truthful for the developer answering, are they affected/manipulated by outside authorities?
-aaron

Robert Says:

I think the culture of the language needs to promote testing. The Perl community has done so in recent years and now testing is part of the culture and a really big deal.

Ronald Says:

1. Yes
2. 80% (working on it)
3. unfortunately not, but it’s something we are aware of and working towards.

prashant Says:

1.Rarely.Sorry for this.Will try to improve from now onwards.
2.People who are in core business functions team write quite often.People like me in web development rarely write in our project.So can say 20%.Now from refactored code base things started improving.
3.Unfortunately not.

Matt Taylor Says:

1. Yes
2. Currently, 1/4 devs on my team are as dedicated to test-first-development as I am.
3. Yes, I do. Of all the places I’ve worked, my current environment is just about ‘average’ when it comes to testing.