“An Empirical Study of Bugs in Test Code”, Arash Vahabzadeh, Amin Milani Fard, and Ali Mesbah.
In Proceedings of the International Conference on Software Maintenance and Evolution (ICSME), 101–110, 2015
[PDF

Abstract

Testing aims at detecting (regression) bugs in production code. However, testing code is just as likely to contain bugs as the code it tests. Buggy test cases can silently miss bugs in the production code or loudly ring false alarms when the production code is correct. We present the first empirical study of bugs in test code to characterize their prevalence and root cause categories. We mine the bug repositories and version control systems of 211 Apache Software Foundation (ASF) projects and find 5,556 test-related bug reports. We (1) compare properties of test bugs with production bugs, such as active time and fixing effort needed, and (2) qualitatively study 443 randomly sampled test bug reports in detail and categorize them based on their impact and root causes. Our results show that (1) around half of all the projects had bugs in their test code; (2) the majority of test bugs are false alarms, i.e., test fails while the production code is correct, while a minority of these bugs result in silent horrors, i.e., test passes while the production code is incorrect; (3) incorrect and missing assertions are the dominant root cause of silent horror bugs; (4) semantic (25%), flaky (21%), environment-related (18%) bugs are the dominant root cause categories of false alarms; (5) the majority of false alarm bugs happen in the exercise portion of the tests, and (6) developers contribute more actively to fixing test bugs and test bugs are fixed sooner compared to production bugs. In addition, we evaluate whether existing bug detection tools can detect bugs in test code.

BibTeX

@inproceedings{icsme15,
  author = {Vahabzadeh, Arash and Milani Fard, Amin and Mesbah, Ali},
  title = {An Empirical Study of Bugs in Test Code},
  booktitle = {Proceedings of the International Conference on Software Maintenance and Evolution (ICSME)},
  publisher = {IEEE Computer Society},
  pages = {101--110},
  year = {2015},
  url = {http://salt.ece.ubc.ca/publications/docs/icsme15.pdf}
}