Skip to content

Commit

Permalink
Added documentation as requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
bvarner committed Jun 4, 2021
1 parent 6d121e4 commit 122ee10
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public class TestConfig {
@ConfigItem
Profile profile;

/**
* JVM parameters that are used to launch jar based integration tests.
*/
@ConfigItem
String integrationJvmArgLine;

/**
* Configures the hang detection in @QuarkusTest. If no activity happens (i.e. no test callbacks are called) over
* this period then QuarkusTest will dump all threads stack traces, to help diagnose a potential hang.
Expand Down
83 changes: 83 additions & 0 deletions docs/src/main/asciidoc/getting-started-testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,89 @@ Finally, if a container image was created during the build (by using including t

As is the case with `@NativeImageTest`, this is a black box test that supports the same set features and has the same limitations.

=== Code Coverage for Integration Tests

To get code coverage data from integration tests, Jacoco needs to be configured, and your `@QuarkusIntegrationTest` classes must be run using a jar package,

In the `pom.xml`, you can add the following plugin configuration for Jacoco. This will append integration test data into the same destination file as unit tests,
re-build the jacoco report after the integration tests are complete, and thus produce a comprehensive code-coverage report.
[source, xml]
----
<build>
...
<plugins>
...
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<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>
<exclClassLoaders>*QuarkusClassLoader</exclClassLoaders>
</configuration>
</execution>
<execution>
<id>report-it</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>
...
</plugins>
...
</build>
----

In order to run the integration tests as a jar with the Jacoco agent, add the following to your `pom.xml`.
[source, xml]
----
<build>
...
<plugins>
...
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<quarkus.test.argLine>${argLine}</quarkus.test.argLine>
<!-- If your integration tests require a different profile, you can set that here as well.
<quarkus.test.native-image-profile>it</quarkus.test.native-image-profile>
-->
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
----


[[test-from-ide]]
== Running `@QuarkusTest` from an IDE

Expand Down

0 comments on commit 122ee10

Please sign in to comment.