Take the 2-minute tour ×

I understand the benefits of test driven development, but have there been any studies that reveal the level of satisfaction with the product or stress levels of the authoring developers with the introduction of unit testing?

I'm looking for case studies, or preferably research papers.

share|improve this question
There are a lot of papers on TDD but from the ones I found tend to match the marketing speak for TDD [its good for 'high stress environments'] –  monksy May 19 '12 at 23:58
answer to a possible duplicate question refers to paper that demonstrates that TDD adds 15-35% development time in return for a 40-90% reduction in defect density on otherwise like-for-like projects... To me, reduction in defects density sounds as close to stress reduction as it gets –  gnat May 24 '12 at 22:25
@gnat This is a more specific question to the link you provided. I don't care about project quality, has it improved the working life of the people writing the software. –  monksy May 25 '12 at 1:16
I just want to say that I have reviewed many of the studies, and I find them lacking in scientific rigour. Observational studies are close to useless. What do we really know about benefits / drawbacks of TDD, not much other than personal opinions. Even if we suppose some of the figures are correct, if I spent another 35% of development time doing code reviews, design by contract, other types of testing etc, what would my reduction in defect density be? –  Antonio2011a May 25 '12 at 10:15
@gnat: That doesn't answer my question. Caring about product quality doesn't equate to less or more stress. –  monksy May 25 '12 at 14:19
show 7 more comments

2 Answers

I don't personally know of any papers that focus on TDD vs Programmer Stress. I can really only offer you anecdotal evidence based on my own experience.

One of the more difficult things when I first tried TDD was to refocus my thinking so that it made more sense to write the test before the code. Often it simply felt easier to get my ideas into code, then follow up with tests. Over time I noticed that the number of noticeable bugs in my code didn't really seem to change and testing seemed to make me to appear to be working more slowly. In a sense, this contributed to additional stress at the time, as it felt like a failure in terms my ability to deliver quality work on time, and all of my scheduling estimates seemed to be way off of what I would have expected.

Fast forward several years with greater experience and the determination to see if I could actually make this approach work. I have changed my approach to using BDD as it seems to fit my mind set better, and to me feels like a better way to do TDD. Not only have I found that I work better this way, but that I can more easily keep myself focused on meeting only the specified requirements. I'm not wasting time with gold-plating, and I'm able to churn out code faster than I used to, simply because my efforts are more focused which ensures I am able to use my time more efficiently. This has had the effect of making even the more mundane tasks enjoyable when my test runner shows me all of my tests passing. I see my code quality improving also, and the code has become easier to maintain over time. All of this has made it much less stressful doing my work.

The thing is, that while I do see that things are better working this way, I can't really draw a direct correlation between TDD and less stress, because there are many other factors that have impacted on the quality of my work life. I have learned other skills over time that have also contributed to an overall reduction of stress levels. Some of those skills are interpersonal, some are simple mindfulness exercises, while other skills have been acquired as a result of reading lots of books about code quality and design which have all had their influence on the way that I go about my work. All of these elements contribute to the amount of stress that I perceive, but no one thing stands out as having had a significant impact by itself.

So while I can't really say that TDD itself reduces stress, I can offer the observation that TDD has helped to improve the way I write software. By helping to make my working life easier, I could argue that TDD has contributed in some way to helping me to maintain a less stressful working situation, but that it is difficult to directly measure the specific amount that TDD has contributed.

share|improve this answer
add comment
 > Test Driven Development, has it reduced stress for developers?

No but it has changed the kind of stress.

In non tdd legacy projects I have stress because of code quality and increased maintenance costs. Especially I have stress in judging why "this tiny change in program logic costs so much time and money".

In tdd projects there are "clever" stakeholders who want to further increase productivity by abolishing the "tdd-waste of time" with all its unnecessary code. So defending TDD is stress.

If you are more productive because of good code quality you have to implement more features in a given timeslot.

I can think of some non-tdd legacy projects that caused a lot of stress where I wished that they were tdd-projects.

share|improve this answer
k3b, you get it. This is exactly what I'm looking for. Has the developer's life become less stressful, and you hit the nail on the head. I would accept this answer, but I'm looking for a study to support the position. Here have an upvote! –  monksy May 25 '12 at 14:15
add comment

Your Answer


