The Community for Technology Leaders
2013 17th European Conference on Software Maintenance and Reengineering (CSMR 2013) (2013)
Genova
March 5, 2013 to March 8, 2013
ISSN: 1534-5351
ISBN: 978-1-4673-5833-0
pp: 111-120
M. F. Aniche , Dept. of Comput. Sci., Univ. of Sao Paulo (USP), São Paulo, Brazil
G. A. Oliva , Dept. of Comput. Sci., Univ. of Sao Paulo (USP), São Paulo, Brazil
M. A. Gerosa , Dept. of Comput. Sci., Univ. of Sao Paulo (USP), São Paulo, Brazil
ABSTRACT
Unit tests and production code are intrinsically connected. A class that is easy to test usually presents desirable characteristics, such as low coupling and high cohesion. Thus, finding hard-to-test classes may help developers identify problematic code. Many different test feedbacks that warn developers about problematic code were already catalogued. In this paper, we argue that analyzing assert instructions in unit tests also aid in identifying and reasoning about potentially problematic pieces of code. We report an analysis conducted with both open source and industry projects relating assert instructions in a unit test with quality measures of the code being tested. We observed that when a production method has a unit test that uses the "assert" instruction in more than one object instance, it often exhibits higher cyclomatic complexity, number of lines of code, or higher number of method invocations. It means that developers should monitor the number of asserts in a unit test as it may indicate problems in the production code.
INDEX TERMS
Production, Industries, Measurement, Software, Complexity theory, Data mining, Testing
CITATION

M. F. Aniche, G. A. Oliva and M. A. Gerosa, "What Do the Asserts in a Unit Test Tell Us about Code Quality? A Study on Open Source and Industrial Projects," 2013 17th European Conference on Software Maintenance and Reengineering(CSMR), Genova, Italy Italy, 2013, pp. 111-120.
doi:10.1109/CSMR.2013.21
94 ms
(Ver 3.3 (11022016))