Code coverage on integration tests?

Update: This post is now available at a new location:
https://blog.ngeor.com/2018/08/11/code-coverage-on-integration-tests.html

Should you collect and measure code coverage on integration tests or only unit tests? In this post I’ll share some thoughts on this topic.

Continue reading Code coverage on integration tests?

Advertisements

Exclude class from JaCoCo coverage

Update: This post is now available at a new location:
https://blog.ngeor.com/2018/04/21/exclude-class-from-jacoco-coverage.html

JaCoCo’s exclude configuration works with classes, so the .class extension is relevant in specifying the path.

Example:


<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.1</version>
    <configuration>
        <excludes>
            <exclude>com/acme/models/Spring*</exclude>

            <exclude>com/acme/api/*Api.class</exclude>

            <exclude>com/acme/generated/**/*</exclude>

        </excludes>
    </configuration>

Code Coverage with JaCoCo

Update: This post is now available at a new location:
https://blog.ngeor.com/2017/03/12/code-coverage-with-jacoco.html

Code Coverage is a useful set of metrics that show you how much of your code you’re impacting during testing. It doesn’t say much about the quality of your tests (you can read more in the old post What is code coverage?), but a 30% coverage is definitely worse than 90%. Let’s see how we can use JaCoCo to see our code coverage in the Java world. We’ll check a few options to use it, such as using it manually, using it within a CI, breaking the build with it, etc. The assumption is we’re working with a Maven project.

Continue reading Code Coverage with JaCoCo