---
component: ROOT
version: "2026.3"
slug: ROOT/using-develocity/index
canonical_url: "https://docs.develocity.ai/2026.3/using-develocity/flaky-test-detection/"
title: "Flaky Test Detection"
description: "Develocity detects non-deterministic tests through within-build detection and cross-build outcome comparison, surfacing flakiness in the Tests Dashboard."
keywords:
  - "flaky tests"
  - "test retry"
  - "failure analytics"
  - "Build Scan"
status: current
---

<!-- llms-index: https://docs.develocity.ai/llms.txt -->

# Flaky Test Detection

<a id="preamble"></a>

A flaky test produces both passing and failing outcomes for the same code and inputs. Develocity detects these tests through two mechanisms and surfaces flakiness data in the Tests Dashboard and the Build Scan.

<a id="within-build-detection"></a>

## Within-Build Detection

When a test fails then passes on retry within the same task execution, Develocity records a `FLAKY` outcome in the Build Scan. `FLAKY` differs from `FAILED`: the test had mixed pass and fail outcomes within the same run, regardless of which occurred first.

![Tests Dashboard showing flaky test outcome counts and a trend line over time](https://docs.develocity.ai/2026.3/using-develocity/flaky-test-detection/../_images/flaky-test-trend.png)

Flaky Test Trend in the Tests Dashboard

Within-build detection works with any mechanism that reruns a failing test in the same task run. Compatible sources include:

*   Built-in retry in the Develocity Gradle plugin
    
*   Maven Surefire `rerunFailingTestsCount`
    
*   Develocity sbt plugin
    
*   Bazel’s `flaky` attribute
    
*   Third-party retry annotations such as junit-pioneer’s `@RetryingTest`
    
*   Jest’s `jest.retryTimes()`
    
*   Mocha’s `this.retries()` (or the `--retries` option)
    
*   Cypress test retries (the `retries` configuration option)
    
*   pytest’s `--retries` option (via the `pytest-retry` plugin)
    

npm and Python (beta) provide within-build detection only; their `FLAKY` outcomes appear in each Build Scan but not in the cross-build Tests Dashboard.

Use `failOnPassedAfterRetry` (Gradle) or `FlakyTestPolicy.Fail` (sbt) to fail the build when a test passes on retry, preserving the flakiness signal as a gate failure.

For retry configuration per build tool, see the [Flaky Test Detection Guide](https://docs.develocity.ai/2026.3/guides/flaky-test-detection-guide/).

<a id="cross-build-detection"></a>

## Cross-Build Detection

Cross-build detection identifies tests that flake too infrequently to fail twice in the same build. The Develocity server compares test outcomes across builds that share the same **input fingerprint**, a hash of the declared inputs to the Gradle task or Maven goal, including source files, classpath, configuration, and environment variables.

![Build Scan test view showing a cross-build flaky indicator beside a test’s primary outcome](https://docs.develocity.ai/2026.3/using-develocity/flaky-test-detection/../_images/cross-build-flaky-test-method.png)

Cross-Build Flakiness in the Build Scan Test View

When a test passes in one build and fails in another with the same input fingerprint, Develocity classifies it as cross-build flaky. Cross-build detection requires no client-side changes and applies automatically to any team publishing a Build Scan with a compatible Develocity Gradle plugin or Maven extension.

> [!NOTE]
> Cross-build detection supports Gradle and Maven only.

<a id="viewing-results"></a>

## Viewing Flaky Test Data

Flaky test data appears in two locations:

*   **Tests Dashboard**: tracks `FLAKY` and cross-build flaky outcomes across builds. Use it to identify the most frequently flaky tests and observe trends over time.
    
*   **Build Scan test view**: within-build flaky tests appear with a `FLAKY` outcome label. Cross-build flaky tests show an indicator beside their primary outcome, which remains `PASSED` or `FAILED` as recorded in that build.
    

<a id="related-documentation"></a>

## Related Documentation

*   [Flaky Test Detection Guide](https://docs.develocity.ai/2026.3/guides/flaky-test-detection-guide/): retry configuration per build tool (Gradle, Maven, sbt, Bazel, npm, and Python)
    
*   [Develocity npm Agent: Viewing Test Results](https://docs.develocity.ai/npm/4.1/npm-agent/#viewing_test_results): enabling and viewing flaky test detection for Jest, Mocha, and Cypress
    
*   [Develocity Python Agent: Viewing Test Results](https://docs.develocity.ai/python/0.10/python-agent/#viewing-test-results): enabling and viewing flaky test detection for pytest (beta)
    
*   [Develocity API Reference](https://docs.develocity.ai/2026.3/reference/develocity-api/openapi-spec/): programmatic access to flaky test data via the Tests endpoint
    
*   [Predictive Test Selection](https://docs.develocity.ai/2026.3/using-develocity/predictive-test-selection/): selects recently flaky tests by default; enabling retry improves prediction accuracy