Join the Beta!

Intelligent Test Runner for Java in beta.

Compatibility

Intelligent Test Runner is supported in dd-java-agent >= 1.18.0.

Setup

Test Visibility setup

Prior to setting up Intelligent Test Runner, set up Test Visibility for Java. If you are reporting data through the Agent, use v6.40+/v7.40+.

UI activation

You, or a user in your organization with “Intelligent Test Runner Activation” permissions, must activate the Intelligent Test Runner on the Test Service Settings page.

Intelligent test runner enabled in test service settings in the CI section of Datadog.

Application key and permissions

The Intelligent Test Runner requires an application key mapped to an owner role with the CI Visibility Read (ci_visibility_read) permission.

For more information on roles and permissions, see the CI Visibility section of the Datadog Role Permissions documentation.

Configuring the test runner environment

Additional Datadog Agent configuration

In addition to the Datadog API Key, a Datadog application key must be specified in the Agent Configuration File.

app_key (Required)
The Datadog application key used to query the tests to be skipped.
Default: (empty)

Environment variables

In addition to the Datadog API Key, a Datadog application key must be provided.

DD_APP_KEY (Required)
The Datadog application key used to query the tests to be skipped.
Default: (empty)

Additional environment variables

To enable Intelligent Test Runner, set the following environment variables:

DD_CIVISIBILITY_JACOCO_PLUGIN_VERSION (Optional)
Intelligent Test Runner requires Jacoco for collecting code coverage.
Set this variable to a valid Jacoco version (such as 0.8.10) if you want the tracer to run your build with Jacoco injected.
Omit it if your project already has Jacoco configured.
Default: (empty)
DD_CIVISIBILITY_JACOCO_PLUGIN_INCLUDES (Optional)
Use this variable to configure the list of packages for which code coverage should be collected.
While this variable is optional, setting this helps reduce overhead by avoiding coverage collection for core JDK classes and third-party dependencies.
Package names should terminate with a * and should be separated with colons: com.myorg.package1.*:com.myorg.package2.*:com.myorg.package3.* or com.myorg.* (if you have a common root package).
Default: (empty)

After setting these environment variables, run your tests as you normally do:

./gradlew cleanTest test --rerun-tasks -Dorg.gradle.jvmargs=\
-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=\
dd.civisibility.enabled=true,\
dd.env=ci,\
dd.service=my-java-app
MAVEN_OPTS=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=\
dd.civisibility.enabled=true,\
dd.env=ci,\
dd.service=my-java-app \
mvn clean verify

Further Reading