Monitoring Java Tests with Any CI Provider
You can integrate any pipeline in just 2 steps. First, you need to install the Thundra Java agent. Then, you need to update the configuration file of your runtime.
You can integrate with any CI pipeline with Foresight to monitor the test runs of your Java project with Maven and Gradle.

Prerequisites

The required parameters are the Thundra API Key and the Thundra Project ID, which can be obtained from the project settings screen.
Once you get your keys, make sure to set it as a secret.
Be aware that to trace JUnit5 tests, junit-platform-launcher and junit-platform-engine dependencies must be available at classpath during test execution.
As you can add those dependencies one by one, you can also simply add only junit-platform-runner dependency which includes both other dependencies mentioned above transitively.

Supported Runtimes

Foresight supports:
for CI Pipelines.

Configuring your Maven Project

Download Java Agent

Download Thundra Java agent using this link.

Configure your pom.xml

Configure the Maven Surefire Plugin and/or the Maven Failsafe Plugin to use Thundra agent as a Java agent:
1
<plugin>
2
<groupId>org.apache.maven.plugins</groupId>
3
<artifactId>maven-surefire-plugin</artifactId>
4
<configuration>
5
<argLine>-javaagent:<YOUR_AGENT_PATH> -Dthundra.apiKey=<API-KEY> -Dthundra.agent.test.project.id=<PROJECT-ID></argLine>
6
</configuration>
7
</plugin>
8
<plugin>
9
<groupId>org.apache.maven.plugins</groupId>
10
<artifactId>maven-failsafe-plugin</artifactId>
11
<configuration>
12
<argLine>-javaagent:<YOUR_AGENT_PATH> -Dthundra.apiKey=<API-KEY> -Dthundra.agent.test.project.id=<PROJECT-ID></argLine>
13
</configuration>
14
<executions>
15
<execution>
16
<goals>
17
<goal>integration-test</goal>
18
<goal>verify</goal>
19
</goals>
20
</execution>
21
</executions>
22
</plugin>
Copied!

Parameters

Name
Requirement
Description
thundra.apiKey
Required
Thundra API Key
thundra.agent.test.project.id
Required
Your project id from Thundra. Will be used to filter and classify your testruns.

Configuring your Gradle Project

Download the Agent

Download Thundra Java agent using this link.

Configure the Gradle’s Test Task

Configure the Gradle’s test task by adding to the jvmArgs attribute the -javaagent argument targeting the Thundra agent based on the property
1
test {
2
jvmArgs '-javaagent:<YOUR_AGENT_PATH>'
3
environment 'THUNDRA_APIKEY', '<YOUR_API_KEY>'
4
environment 'THUNDRA_AGENT_TEST_PROJECT_ID', '<YOUR_PROJECT_ID>'
5
}
Copied!

Parameters

Name
Requirement
Description
THUNDRA_APIKEY
Required
Thundra API Key
THUNDRA_AGENT_TEST_PROJECT_ID
Required
Your project id from Thundra. Will be used to filter and classify your testruns.
Last modified 8d ago