Monitoring Java tests using Jenkins

Introduction for Foresight Jenkins Plugin

Foresight’s Jenkins Plugin automatically changes your build configurations to integrate with Thundra Foresight.
You can integrate your Jenkins pipeline in just 2 steps. After completing those steps, Foresight will capture your test runs automatically.
Learn more about What is Foresight and the Benefits of Using Foresight in your Jenkins Pipeline.

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.

Foresight's Jenkins plugin supports:

  • Maven
  • Gradle
Foresight's plugin automatically detects which runtime you have. Learn more about integrations.

Configurations for Jenkins

To install Foresight plugin, go to the Plugin Manager and search for “Thundra Foresight Plugin” and install the plugin.
After installing the plugin, create a global credential for Thundra Foresight Api Key with the type Secret Text. Credential creation documentation is here
After creating the secret, select the project you want to enable Thundra Foresight, or create a new project.
Go to the Configurations, and select the Build Environment section. Add a build step and select the Foresight plugin
Enter your Foresight configurations ProjectId and API Key on the Build Environment section.

Maven

Gradle

For the pipeline projects we can simply add those steps to enable the plugin:
mavenForesight(projectId:'<Your-Project-Id>', credentialId: '<Your-Credentials-Id>')
gradleForesight(projectId:'<Your-Project-Id>', credentialId: '<Your-Credentials-Id>')
Last modified 18d ago