Related resources
Search for item elsewhere
University researcher(s)
Academic department(s)
Is Code Quality Related to Test Coverage?
Jorge Arturo Wong-Mozqueda, Robert Haines, Caroline Jay
In: International Workshop on Sustainable Software Systems Engineering: International Workshop on Sustainable Software Systems Engineering; 26 Oct 2015; Liverpool. CEUR Workshop Proceedings; 2015.
Access to files
- FULL-TEXT.PDF (pdf)
Abstract
A good test suite is vital for minimising errors, and ensuring that software is easy to maintain. Another factor viewed as being important for the success and longevity of software is code quality. We report on work examining whether there is a correlation between code quality and test coverage, using seven different metrics: lines of code, McCabe's cyclomatic complexity, number of local methods, depth of inheritance tree, coupling between objects, improvement of lack of cohesion in methods and lack of documentation. An analysis of three large, open source Java projects showed that all of the response variables had a modest but significant relationship with line coverage, and a stronger relationship with branch coverage: as coverage rose, so did software quality. We propose that writing tests may help people to adopt a 'software quality' mindset, by encouraging them to think about how code will be used as it is written. Testing may improve software sustainability not only by helping to ensure code does not regress, but also by supporting developers in adopting good software engineering practices.