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. Contact Develocity support or your customer representative to enable it.

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 across many Develocity installations, so predictions are meaningful even before your project has accumulated extensive history.

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

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. Tests that are recently new, recently changed, recently failed, or recently flaky are always selected.

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 confidence that all relevant failures are caught. Time savings are lower than Standard.

Standard

The default. Balances confidence and time savings.

Fast

Selects fewer tests to maximize time savings. Saves more time than Standard, with reduced confidence in catching all failures.

The Predictive Test Selection Simulator in Develocity lets you assess the expected benefits and risks of enabling PTS for your builds using your historical build data. It visualizes predicted failure detection rates, savings potential, and avoidable compared to unavoidable test counts, and lets you compare outcomes across selection profiles.

When to Use Predictive Test Selection

Predictive Test Selection trades testing comprehensiveness for faster feedback. It suits builds where reducing feedback time is the priority, such as local and pre-merge checks.

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 weren’t 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