Predictive Test Selection


Predictive Test Selection uses a machine learning model to identify which tests are relevant to a code change and runs only those tests. You trade full test coverage for faster feedback: local and pre-merge builds complete faster, while a subsequent pipeline stage can run the remaining tests.

Predictive Test Selection is an extension and may not be enabled for your installation. To enable it, contact Develocity support or your customer representative.

The Predictive Model

Develocity trains a predictive model by observing code changes and test outcomes from your Build Scan data. It combines this per-project learning with training from millions of test executions across many projects. Until a project has enough change and test history for a prediction, Develocity selects all impacted tests.

Before each test run, the model cross-references a snapshot of the test suite and the code under test with change and outcome history. It then selects the tests most likely to provide useful feedback on the change.

Diagram showing the predictive model mapping code changes to a selected subset of tests
How Predictive Test Selection Works

The model updates with each new Build Scan published to Develocity, so predictions improve as more build data accumulates. Develocity always selects tests that were recently added, changed, failed, or found flaky.

Selection Profiles

A selection profile controls how the model balances prediction confidence against time savings. Develocity provides three predefined profiles:

Profile Behavior

Conservative

Selects more tests to maximize the likelihood of catching every relevant failure. Time savings are lower than Standard.

Standard

The default. Balances confidence and time savings.

Fast

Selects fewer tests to maximize time savings. Confidence in catching all failures is lower than Standard.

The Predictive Test Selection Simulator replays your historical build data to estimate what enabling PTS would have saved, and what it would have missed. It reports predicted failure detection rates, savings potential, and avoidable and unavoidable test counts, and lets you compare the three selection profiles.

When to Use Predictive Test Selection

Enable Predictive Test Selection where feedback time matters more than running every test, such as local pre-commit checks and pre-merge CI jobs.

Relevant Tests and Remaining Tests

Predictive Test Selection supports two selection modes:

  • Relevant tests mode selects the most relevant subset for the current changeset. Use this for pre-merge CI jobs and local pre-commit checks to get fast feedback.

  • Remaining tests mode selects the tests that were not run in a prior relevant-tests execution against the same changeset. Use this for post-merge or nightly builds to ensure complete coverage.

Pairing these two modes across pipeline stages means each test runs at most once per changeset.

CI pipeline diagram showing relevant tests in the pre-merge stage and remaining tests in a post-merge stage
CI Pipeline with Relevant Tests and Remaining Tests