Effectiveness of TDD on Unit Testing Practice
نویسنده
چکیده
Background: Several studies report that test driven development (TDD) has effects on the software product e.g. code quality and developers’ productivity. In recent literature reviews, the impact of TDD on source code quality is seen as a more focused area in empirical research compared to unit testing. However, the quality of production code is tightly coupled with the quality of test code. Objective: The aim of this study is to investigate the impact of test driven development approach compared to an incremental test last development (ITLD), on unit test case quality. The impact is measured in terms of code coverage and mutation score metrics. The hypotheses test the differences in the quality of test cases produced using TDD and ITLD approaches. Method: We conducted an experiment in an industrial setting with 24 professionals in five consecutive days. Three programing tasks, i.e. one task using ITLD and two tasks using TDD, are selected for the experiment. We extracted unit test case quality attributes i.e. mutation score and code coverage from the data collected on each day of the experiment. For the code coverage, we used the metrics; instruction, branch, method, cyclomatic complexity and line coverage. The difference of mutation score and code coverage metrics are then evaluated using non-parametric significance tests. Results: The results indicate that except three metrics i.e. branch coverage, method coverage, mutation score, we could not find significant differences in terms of unit test case quality between the treatments. Subjects wrote test cases that cover more branches during TDD practice on a green-field (as a new development) task, compared to ITLD and TDD practice on a brown-field (modifications on an existing code base) task. In terms of method coverage, test cases produced using ITLD covered more methods than both TDD tasks; whereas no significant difference is found for method coverage between the both TDD tasks. In terms of mutation score, test cases written during TDD practice on a green-field task have more defect detection abilities than test cases written during ITLD practice and TDD practice on a brown-field task. Conclusion: Our finding are different from previous studies performed at academic settings. We believe that other factors (i.e. task’s complexity, experiment duration and participant’s interest towards tasks) could influence the results. Therefore, future studies could be designed by minimizing the impact of these factors to get more generalizable results.
منابع مشابه
Test Driven Development Method in Software Development Process
Test-driven development (TDD) is an advanced technique of using automated unit tests to drive the design of software and force decoupling of dependencies. TDD does not replace traditional testing, instead it defines a proven way to ensure effective unit testing. The overall initiative results in continuous improvements and provides a mechanism for propagating the lessons learned between project...
متن کاملPrioritizing the creation of unit tests in legacy software systems
Test-Driven Development (TDD) is a software development practice that prescribes writing unit tests before writing implementation code. Recent studies have shown that TDD practices can significantly reduce the number of pre-release defects. However, most TDD research thus far has focused on new development. We investigate the adaptation of TDD-like practices for already-implemented code, in par...
متن کاملA structured experiment of test-driven development
Test Driven Development (TDD) is a software development practice in which unit test cases are incrementally written prior to code implementation. We ran a set of structured experiments with 24 professional pair programmers. One group developed a small Java program using TDD while the other (control group), used a waterfall-like approach. Experimental results, subject to external validity concer...
متن کاملThe Role of Process Measurement in Test-Driven Development
Test-Driven Development (TDD) is a coding technique in which programmers write unit tests before writing or revising production code. We present a process measurement approach for TDD that relies on the analysis of fine-grained data collected during coding activities. This data is mined to produce abstractions regarding programmers’ work patterns. Programmers, instructors, and coaches receive c...
متن کاملSoftware Architecture Improvement through Test-Driven Development: An Empirical Study
Despite a half century of advances, the software construction industry still shows signs of immaturity. Professional software development organizations continue to struggle to produce reliable software in a predictable and repeatable manner. While a variety of development practices are advocated that might improve the situation, developers are often reluctant to adopt new, potentially better pr...
متن کامل