Assert Use and Defectiveness in Industrial Code
Steve Counsell, Tracy Hall, Thomas Shippey, David Bowes, Amjed Tahir, and Stephen MacDonell

TL;DR
This study investigates the relationship between assert usage, defectiveness, and method characteristics in industrial Java systems, revealing limited support for previous findings and highlighting the complexity of assert-related defect proneness.
Contribution
It provides an empirical analysis of assert placement and defectiveness in industrial code, challenging prior assumptions and exploring the influence of method size and assert position.
Findings
Limited evidence supporting previous claims about asserts reducing defects.
Defective methods with one assert are located lower in class hierarchy.
Method size correlates with assert usage, especially when multiple asserts are present.
Abstract
The use of asserts in code has received increasing attention in the software engineering community in the past few years, even though it has been a recognized programming construct for many decades. A previous empirical study by Casalnuovo showed that methods containing asserts had fewer defects than those that did not. In this paper, we analyze the test classes of two industrial telecom Java systems to lend support to, or refute that finding. We also analyze the physical position of asserts in methods to determine if there is a relationship between assert placement and method defect-proneness. Finally, we explore the role of test method size and the relationship it has with asserts. In terms of the previous study by Casalnuovo, we found only limited evidence to support the earlier results. We did however find that defective methods with one assert tended to be located at significantly…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
