Is there hard evidence of the ROI of unit testing?

前端 未结 11 2349
既然无缘
既然无缘 2020-12-12 08:54

Unit testing sounds great to me, but I\'m not sure I should spend any time really learning it unless I can convince others that is has significant value. I have to convince

11条回答
  •  时光取名叫无心
    2020-12-12 09:54

    Just to add more information to these answers, there are two meta-analysis resources that may help out figuring out productivity & quality effects on academic and industry background:

    Guest Editors' Introduction: TDD—The Art of Fearless Programming [link]

    All researchers seem to agree that TDD encourages better task focus and test coverage. The mere fact of more tests doesn't necessarily mean that software quality will be better, but the increased programmer attention to test design is nevertheless encouraging. If we view testing as sampling a very large population of potential behaviors, more tests mean a more thorough sample. To the extent that each test can find an important problem that none of the others can find, the tests are useful, especially if you can run them cheaply.

    Table 1. A summary of selected empirical studies of test-driven development: industry participants*

    Table 2. A summary of selected empirical studies of TDD: academic participants*

    The Effects of Test-Driven Development on External Quality and Productivity: A Meta-Analysis [link]

    Abstract:

    This paper provides a systematic meta-analysis of 27 studies that investigate the impact of Test-Driven Development (TDD) on external code quality and productivity.

    The results indicate that, in general, TDD has a small positive effect on quality but little to no discernible effect on productivity. However, subgroup analysis has found both the quality improvement and the productivity drop to be much larger in industrial studies in comparison with academic studies. A larger drop of productivity was found in studies where the difference in test effort between the TDD and the control group's process was significant. A larger improvement in quality was also found in the academic studies when the difference in test effort is substantial; however, no conclusion could be derived regarding the industrial studies due to the lack of data.

    Finally, the influence of developer experience and task size as moderator variables was investigated, and a statistically significant positive correlation was found between task size and the magnitude of the improvement in quality.

提交回复
热议问题