1

I've followed the steps that I understand should generate a report containing consolidated coverage from all my @QuarkusTest and @QuarkusIntegrationTest classes, but it seems that @QuarkusTest coverage is ignored.

I add a dependency on quarkus-jacoco:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-jacoco</artifactId>
    <scope>test</scope>
</dependency>

I configure the jacoco-maven-plugin:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.10</version>
    <executions>
        <execution>
            <id>default-prepare-agent</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
            <configuration>
                <exclClassLoaders>*QuarkusClassLoader</exclClassLoaders>
                <destFile>${project.build.directory}/jacoco-quarkus.exec</destFile>
                <append>true</append>
            </configuration>
        </execution>
        <execution>
            <id>default-prepare-agent-integration</id>
            <goals>
                <goal>prepare-agent-integration</goal>
            </goals>
            <configuration>
                <destFile>${project.build.directory}/jacoco-quarkus.exec</destFile>
                <append>true</append>
            </configuration>
        </execution>
        <execution>
            <id>report</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>report</goal>
            </goals>
            <configuration>
                <dataFile>${project.build.directory}/jacoco-quarkus.exec</dataFile>
                <outputDirectory>${project.build.directory}/jacoco-report</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

And I execute a build:

./mvnw clean verify -Dquarkus.package.write-transformed-bytecode-to-build-output=true

All tests run and pass, but the report appears to only show coverage from @QuarkusIntegrationTests. Code that is clearly touched by @QuarkusTests is shown as uncovered.

If I remove the explicit report execution section, the report is generated earlier and correctly shows @QuarkusTest coverage which proves the stats do get generated, but omits @QuarkusIntegrationTest coverage.

It seems like the <append>true</append> instructions are being ignored.

Can anyone see what I am missing?

EDIT: I tried generating distinct exec files for the two types of test and then using the merge goal to combine them , but got the same result.

zforgo
  • 2,508
  • 2
  • 14
  • 22
elgaz
  • 193
  • 1
  • 1
  • 13
  • https://stackoverflow.com/questions/48942083/how-to-merge-2-jacoco-coverage-reports-exec-file-irrespective-of-maven-life-c – Luca Basso Ricci Jun 21 '23 at 06:33
  • Thanks for the suggestion.. I should have said I'd tried generating distinct exec files for the two types of test and then using the `merge` goal to combine them , but got the same result. As far as I can tell, outputting the coverage of both test types to the same file with `append=true` should work, I'm wonder if there is an additional step I am missing. – elgaz Jun 21 '23 at 08:09

0 Answers0