Retrofitting unit tests for parameterized unit testing

  • Authors:
  • Suresh Thummalapenta;Madhuri R. Marri;Tao Xie;Nikolai Tillmann;Jonathan de Halleux

  • Affiliations:
  • Department of Computer Science, North Carolina State University, Raleigh;Department of Computer Science, North Carolina State University, Raleigh;Department of Computer Science, North Carolina State University, Raleigh;Microsoft Research, One Microsoft Way, Redmond;Microsoft Research, One Microsoft Way, Redmond

  • Venue:
  • FASE'11/ETAPS'11 Proceedings of the 14th international conference on Fundamental approaches to software engineering: part of the joint European conferences on theory and practice of software
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recent advances in software testing introduced parameterized unit tests (PUT), which accept parameters, unlike conventional unit tests (CUT), which do not accept parameters. PUTs are more beneficial than CUTs with regards to fault-detection capability, since PUTs help describe the behaviors of methods under test for all test arguments. In general, existing applications often include manually written CUTs. With the existence of these CUTs, natural questions that arise are whether these CUTs can be retrofitted as PUTs to leverage the benefits of PUTs, and what are the cost and benefits involved in retrofitting CUTs as PUTs. To address these questions, in this paper, we conduct an empirical study to investigate whether existing CUTs can be retrofitted as PUTs with feasible effort and achieve the benefits of PUTs in terms of additional fault-detection capability and code coverage. We also propose a methodology, called test generalization, that helps in systematically retrofitting existing CUTs as PUTs. Our results on three real-world open-source applications (≈ 4.6 KLOC) show that the retrofitted PUTs detect 19 new defects that are not detected by existing CUTs, and also increase branch coverage by 4% on average (with maximum increase of 52% for one class under test and 10% for one application under analysis) with feasible effort.