Published Sep 3, 2019

SE-Radio Episode 324: Marc Hoffmann on Code Test Coverage Analysis and Tools

Marc Hoffmann, a leading developer of the JaCoCo code coverage library, delves into the intricacies of code test coverage analysis, discussing its critical role in software reliability and the integration of such tools into development pipelines to bolster software quality.
Episode Highlights
Software Engineering Radio - the podcast for professional software developers logo

Popular Clips

Episode Highlights

  • Code Coverage

    , a leading expert in bytecode coverage analysis, explains the significance of code coverage in software testing. This dynamic metric records which parts of the code have been executed during testing, offering insights into untested areas that may require additional scrutiny or even removal. emphasizes that code coverage helps maintain a clean and tested codebase, particularly in automated unit tests, by identifying untested code segments that could be potential weaknesses 1.

    Code coverage gives you a good idea, especially about the untested parts of your code base, so you can identify the places which need more testing.

    ---

    He advises focusing on the quality of tests rather than just the coverage percentage, as high coverage doesn't necessarily equate to effective testing 2.

       

    Tools Overview

    In the realm of Java, several tools are available for code coverage analysis, each with unique features and benefits. highlights tools like JaCoCo, known for its minimal performance impact, and OpenClover, which offers traceability between unit tests and the lines of code they touch 3.

    The main benefit of JaCoCo is that there's literally no performance regression if you run it in your build.

    ---

    Choosing the right tool involves considering factors such as runtime footprint, feature set, and compatibility with the latest Java versions, as these can significantly affect the efficiency and effectiveness of the testing process 4.

       

    Practical Use

    Implementing code coverage effectively requires strategic planning and understanding of the project's structure. advises separating unit-testable components from glue code, which connects to databases or file systems, to focus testing efforts where they are most beneficial 5.

    I always recommend to provide abstractions, for example, for file system access or database access, so you can create real unit tests for the core part of the application.

    ---

    He warns against setting unrealistic expectations based solely on coverage metrics, as this can lead to misguided efforts like outsourcing test creation, which often fails to enhance code quality 6.

Related Episodes