Rerun only failed tests
Rerunning only failed tests is built in to circleci testsuite run and is free, with no extra configuration. When you rerun a workflow from failed, circleci testsuite run reruns only the tests that failed in the previous run, instead of your entire test suite. This shortens time-to-feedback and avoids spending credits on tests that already passed.
Prerequisites
Before rerunning only failed tests, ensure you have completed the Getting Started With Smarter Testing guide and have:
-
Configured your
.circleci/test-suites.ymlwithdiscoverandruncommands. -
Replaced your test command with
circleci testsuite run.
Rerun a workflow from failed
You can rerun a workflow from failed in any of the following ways:
-
Web app: Select Rerun workflow from failed. See Rerunning a Workflow’s Failed Jobs.
-
API: Use the rerun workflow endpoint with
is_from_failedset totrue. -
CLI: Run
circleci workflow rerun <workflow-id> --from-failed.
Rerun failed tests automatically
To rerun failed tests automatically during the same run, without rerunning the workflow, use Auto Rerun Failed Tests, which has a credit charge above your plan’s allowance.
This page covers circleci testsuite. If you use the legacy circleci tests run command, see Rerun Failed Tests With the Tests Run Command.
|
Next steps
-
Use Static Test Splitting to split your tests across parallel nodes.
-
Auto Rerun Failed Tests to automatically retry flaky tests.