dotnet-test-rerun
dotnet test has no built-in way to retry failed tests. dotnet-test-rerun wraps it: it runs your tests, reads the TRX results to find the failed ones, and runs only those again, up to --rerunMaxAttempts times.
Use it when tests fail for reasons outside your code: a database that is still starting, a rate-limited API, a slow browser in a UI test, a test host that crashed.
Quick start
dotnet tool install --global dotnet-test-rerun
test-rerun path/to/MyTests.csproj
The path can be anything dotnet test accepts: a project, a solution, a directory or a test .dll. Every dotnet test option you already use (--filter, --configuration, --no-build, --logger, /p:...) works the same way.
What you get
- Only failed tests are rerun. A filter is built from the TRX results, so a rerun takes seconds, not the whole suite.
- xUnit, NUnit and MSTest, including parameterised tests, and projects that target several frameworks.
- Safety limits. Skip reruns when too many tests fail (
--rerunMaxFailedTests,--rerunFailedThreshold). - Merged code coverage across all runs (
--mergeCoverageFormat). - A clear exit code:
0when every test passed in the end,1otherwise.
Where to go next
| Page | Read it to |
|---|---|
| Installation | Install the tool globally, locally, or use Docker |
| Command reference | Look up every option and its default |
| How it works | Understand the rerun loop, the filters and the results folders |
| Guides | Tune reruns, logging, code coverage and run settings |
| CI integration | Copy a GitHub Actions, Azure DevOps or GitLab CI setup |
| Docker | Run the tool from a container image |
| Upgrading from 4.x | See what changed in 5.0 and update your CI |
| Troubleshooting | Fix common problems |
| Contributing | Build, test and change the tool |
License
Copyright © 2023-2026 João Pereira. Licensed under the GNU General Public License v3.0.