Is Code Quality Related to Test Coverage?

Caroline Jay, Jorge Arturo Wong-Mozqueda, Robert Haines

    Research output: Contribution to conferencePoster

    373 Downloads (Pure)


    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.
    Original languageEnglish
    Publication statusPublished - 26 Oct 2015
    EventInternational Workshop on Sustainable Software Systems Engineering - Liverpool
    Duration: 26 Oct 2015 → …


    ConferenceInternational Workshop on Sustainable Software Systems Engineering
    Period26/10/15 → …


    Dive into the research topics of 'Is Code Quality Related to Test Coverage?'. Together they form a unique fingerprint.

    Cite this