이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Test Optimization is not available in the selected site () at this time.

Overview

Test Optimization’s Auto Test Retries feature allows retrying failing tests up to N times to avoid failing your build due to flaky tests: a failing test case is retried either until it passes successfully or until there are no more retry attempts left (in which case the build fails).

Setup

Ensure Test Optimization is configured for your test runs.

Compatibility

  • dd-trace-java >= 1.34.0
  • dd-trace-js >= v5.19.0 and dd-trace-js >= v4.43.0
  • datadog-ci-rb >= 1.4.0
  • dd-trace-dotnet >= 3.4.0
  • orchestrion >= 0.9.4 + dd-trace-go >= 1.69.1

Configuration

After you have set up Test Optimization, you can configure Auto Test Retries from the Test Service Settings page.

Auto Test Retries in Test Service Settings.

The default behavior of the feature is to retry any failing test case up to 5 times. This behavior can be fine-tuned with the following environment variables:

  • DD_CIVISIBILITY_FLAKY_RETRY_ONLY_KNOWN_FLAKES - if this environment variable is set to true, only the test cases that Test Optimization considers flaky are retried.
  • DD_CIVISIBILITY_FLAKY_RETRY_COUNT - can be set to any non-negative number to change the maximum number of retries per test case.

After you have set up Test Optimization, you can configure Auto Test Retries from the Test Service Settings page.

Auto Test Retries in Test Service Settings.

The default behavior of the feature is to retry any failing test case up to 5 times. This behavior can be fine-tuned with the following environment variables:

  • DD_CIVISIBILITY_FLAKY_RETRY_ENABLED - set to 0 or false to explicitly disable retries even if the remote setting is enabled (default: true).
  • DD_CIVISIBILITY_FLAKY_RETRY_COUNT - a non-negative number to change the maximum number of retries per test case (default: 5).

Known limitations

jest-image-snapshot is incompatible with jest.retryTimes unless customSnapshotIdentifier is passed (see jest-image-snapshot docs) to toMatchImageSnapshot. Therefore, auto test retries do not work unless customSnapshotIdentifier is used.

After you have set up Test Optimization, you can configure Auto Test Retries from the Test Service Settings page.

Auto Test Retries in Test Service Settings.

The default behavior of the feature is to retry any failing test case up to 5 times. This behavior can be fine-tuned with the following environment variables:

  • DD_CIVISIBILITY_FLAKY_RETRY_ENABLED - set to 0 or false to explicitly disable retries even if the remote setting is enabled (default: true)
  • DD_CIVISIBILITY_FLAKY_RETRY_COUNT - a non-negative number to change the maximum number of retries per test case (default: 5).
  • DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT - a non-negative number to set the maximum total number of failed tests to retry (default: 1000)

After you set up Test Visibility, you can configure Auto Test Retries from the Test Service Settings page.

Auto Test Retries enabled in Test Service Settings.

By default, the feature retries any failing test case up to 5 times. Customize the Auto Test Retries with the following environment variables:

  • DD_CIVISIBILITY_FLAKY_RETRY_ENABLED - set to 0 or false to explicitly disable retries even if the remote setting is enabled (default: true)
  • DD_CIVISIBILITY_FLAKY_RETRY_COUNT - a non-negative number to change the maximum number of retries per test case (default: 5).
  • DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT - a non-negative number to set the maximum total number of failed tests to retry (default: 1000)
Test optimization for Go is in Preview.

After you set up Test Visibility, you can configure Auto Test Retries from the Test Service Settings page.

Auto Test Retries enabled in Test Service Settings.

By default, the feature retries each failing test case up to 5 times. Customize the Auto Test Retries with the following environment variables:

  • DD_CIVISIBILITY_FLAKY_RETRY_ENABLED - set to 0 or false to explicitly disable retries even if the remote setting is enabled (default: true)
  • DD_CIVISIBILITY_FLAKY_RETRY_COUNT - a non-negative number to change the maximum number of retries per test case (default: 5).
  • DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT - a non-negative number to set the maximum total number of failed tests to retry (default: 1000)

Explore results in the Test Optimization Explorer

You can query the retried tests in the Test Optimization Explorer: they have the @test.is_retry tag set to true (some of them may also have the @test.is_new set to true, which indicates they have been retried by the Early Flakiness Detection feature).

Troubleshooting

If you suspect there are any issues with Auto Test Retries, navigate to the Test Service Settings page, look for your test service, and click Configure. Disable Auto Test Retries by clicking on the toggle.

Further Reading