Monitoring Java Tests using TeamCity
You can integrate your TeamCity pipeline workflow with Foresight to monitor the test runs of your Java project with Maven and Gradle.

Introduction for Foresight TeamCity Plugin

Foresight’s TeamCity Plugin automatically changes your build configurations to integrate with Thundra Foresight.
You can integrate your TeamCity pipeline in just 2 steps. First, you need to install the plugin. Then, configure your TeamCity Project or Build Configuration. After completing those steps, Foresight will capture your test runs automatically.

Prerequisites for TeamCity

    1.
    Thundra Account to record and manage all the process
    2.
    Foresight project to gather parameters
    3.
    Thundra API Key to connect your pipeline with the Thundra Java agent. It can be obtained from the project settings page.
    4.
    Thundra Project ID to connect your test runs with the Foresight project. It can be obtained from the project settings page.
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 Frameworks

Foresight's TeamCity plugin supports:
    Maven
    Gradle
runtimes. Foresight's plugin automatically detects which runtime you have. Learn more about integrations:

Starting with a TeamCity Project Settings

If you choose to start with the Project Settings option, all build configurations under this project will send test data to Thundra Foresight.
1) Navigate through your TeamCity project settings, as shown below, it is on the top right of your project page.
2) After navigating your project settings
    1.
    Click Parameters
    2.
    Click on Add Parameter
    3.
    Add Environment Variables (Recommended) and set the THUNDRA_APIKEY and THUNDRA_AGENT_TEST_PROJECT_ID
Parameters page for adding Foresight parameters

You can also start using TeamCity plugin by changing the Build Configuration settings. If you chose to start with build configuration settings, you need to configure each pipeline by itself.

Monitoring your First Run

After completing the steps successfully, you are ready to monitor your first test run! After committing the latest version of your project, you will be able to see your test run results.
You need to see your test runs are listed as shown above
For more information

Parameters

    THUNDRA_APIKEY (required): to connect your pipeline with the Thundra Java agent. It can be obtained from the project settings page.
    THUNDRA_AGENT_TEST_PROJECT_ID(required): Your project ID from Thundra Foresight, which is used to filter and classify your test runs.
    THUNDRA_GRADLE_PLUGIN_VERSION (optional): In the plugin itself, we use a Gradle plugin to run your tests. This plugin is released and versioned separately from the TeamCity plugin. Hence, if there is some breaking change or specific version you want to use, you can use it by defining this parameter.
Last modified 8d ago