4

According to Quarkus Documentation, to have JaCoCo considering test classes that aren't annotated with @QuarkusTest, the only thing we need to do is to configure the jacoco plugin to execute the goal prepare-agent.

I've added that, the same as the documentation suggests:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>${jacoco.version}</version>
    <executions>
      <execution>
        <id>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>
    </executions>
  </plugin>

Although, my unit tests haven't been taken into count.

My quarkus version is 2.10.3.Final and the jacoco plugin is set for 0.8.8.

I'm using jupiter 5.8.2 for the unit tests.

Thanks

1 Answers1

0

Quarkus IO

As the documentation says, this setup only works if at least one @QuarkusTest is run. the jacoco standard setup might solve your problem. in the maven build log you can read two line like this:

[INFO] --- jacoco-maven-plugin:0.8.8:report (jacoco-report) @ project-name ---
[INFO] Skipping JaCoCo execution due to missing execution data file.

The standard jacoco configuration:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>${jacoco.version}</version>
    <executions>
      <execution>
        <id>prepare-agent</id>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
        <configuration>
          <destFile>${project.build.directory}/jacoco-quarkus.exec</destFile>
          <append>true</append>
        </configuration>
      </execution>
    </executions>
  </plugin>

NOTE: With the standard configuration tests annotated with @QuarkusTest are not managed by the jacoco plugin

Raffaele
  • 26
  • 3