dotnet-test-rerun 4.1.0

dotnet tool install --global dotnet-test-rerun --version 4.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-test-rerun --version 4.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-test-rerun&version=4.1.0
                    
nuke :add-package dotnet-test-rerun --version 4.1.0
                    

<div align="center">

🔄 dotnet-test-rerun

Automatically rerun failed .NET tests until they pass

Build Status Coverage Status NuGet Version NuGet Downloads Docker Pulls

📖 Documentation🐛 Issues

</div>


🎯 Why dotnet-test-rerun?

Ever had tests fail intermittently due to network issues, timing problems, or external service hiccups? dotnet-test-rerun solves this by automatically rerunning failed tests, making your test suites more resilient and your CI/CD pipelines more reliable.

✨ Key Features

Feature Description
🔄 Smart Retry Automatically reruns only failed tests with configurable attempts
🎯 Selective Execution Targets specific tests with filters instead of rerunning everything
📊 Multiple Loggers Supports trx, junit, console, and custom test loggers
🐳 Docker Ready Pre-built images for .NET 8.0, 9.0, and 10.0
⚙️ Highly Configurable Extensive options for filtering, delays, and test execution
📈 Code Coverage Collect and merge coverage reports across retry attempts
Performance First Efficient execution by targeting only failed tests
🔧 CI/CD Optimized Built-in support for GitHub Actions, Azure DevOps, GitLab CI

🚀 Quick Start

Installation

# Install as a global .NET tool
dotnet tool install --global dotnet-test-rerun

Basic Usage

# Run tests with automatic retry (default: 3 attempts)
test-rerun path/to/test.dll

# Customize retry attempts
test-rerun path/to/test.dll --rerunMaxAttempts 5

# Add delay between retries (useful for external dependencies)
test-rerun path/to/test.dll --rerunMaxAttempts 5 --delay 10

Docker Usage

# Use the latest stable version (.NET 10.0)
docker run joaoopereira/dotnet-test-rerun:latest path/to/test.dll --rerunMaxAttempts 3

# Or specify a .NET version
docker run joaoopereira/dotnet-test-rerun:4.0.0-net8 path/to/test.dll

📚 Common Use Cases

<details> <summary><b>🌐 Integration Tests with External Services</b></summary>

test-rerun IntegrationTests.dll \
  --filter "Category=Integration" \
  --rerunMaxAttempts 5 \
  --delay 10 \
  --rerunMaxFailedTests 15

Perfect for tests that interact with databases, APIs, or microservices that may have transient failures.

</details>

<details> <summary><b>🚀 CI/CD Pipeline Integration</b></summary>

# GitHub Actions example
- name: Run Tests with Retry
  run: |
    test-rerun tests/**/*.dll \
      --configuration Release \
      --rerunMaxAttempts 3 \
      --logger "trx;LogFileName=results.trx" \
      --results-directory ./TestResults

Make your CI/CD pipelines more resilient to intermittent failures.

</details>

<details> <summary><b>📊 Code Coverage Collection</b></summary>

test-rerun MyTests.dll \
  --collect "XPlat Code Coverage" \
  --mergeCoverageFormat Cobertura \
  --rerunMaxAttempts 3

Collect and merge coverage reports even when tests need multiple attempts to pass.

</details>

<details> <summary><b>🎭 UI/Selenium Tests</b></summary>

test-rerun UITests.dll \
  --filter "Category=UI" \
  --rerunMaxAttempts 10 \
  --delay 3 \
  --blame

Handle flaky UI tests with generous retry attempts and blame mode for debugging.

</details>


📦 Installation Options

<table> <tr> <td width="50%">

dotnet tool install --global dotnet-test-rerun
test-rerun --help

✅ Available system-wide
✅ Easy to update
✅ Simple command

</td> <td width="50%">

Docker

docker pull joaoopereira/dotnet-test-rerun:latest
docker run joaoopereira/dotnet-test-rerun:latest

✅ No installation needed
✅ Multiple .NET versions
✅ Isolated environment

</td> </tr> </table>

Other options: Local ToolNuGet Package


🎛️ Configuration Options

Core Options

Option Default Description
--rerunMaxAttempts 3 Maximum number of retry attempts
--rerunMaxFailedTests -1 Maximum failed tests to rerun (no limit)
--delay, -d - Delay between retries in seconds
--filter - Run tests matching the expression
--deleteReports false Clean up report files after execution

Test Execution

Option Description
--configuration, -c Build configuration (Debug/Release)
--framework, -f Target framework to test
--no-build Skip building before testing
--blame Enable blame mode for diagnostics
--collect Enable data collectors (e.g., code coverage)

Logging & Output

Option Default Description
--logger, -l trx Test result logger (trx, junit, console)
--results-directory, -r - Output directory for test results
--loglevel Verbose Tool log level
--verbosity, -v - dotnet test verbosity level

📘 View All OptionsConfiguration GuideExamples


🐳 Docker Images

Tag Pattern .NET Runtime Use Case
latest, {version} .NET 10.0 Latest stable release
{version}-net10 .NET 10.0 Explicit .NET 10.0
{version}-net9 .NET 9.0 .NET 9.0 projects
{version}-net8 .NET 8.0 .NET 8.0 projects (LTS)

Example:

docker run joaoopereira/dotnet-test-rerun:4.0.0-net8 tests/MyTests.dll --rerunMaxAttempts 3

🐳 Docker Hub RepositoryDocker Guide


🤝 Contributing

Contributions are welcome! We appreciate:

  • 🐛 Bug reports and fixes
  • ✨ New features and enhancements
  • 📖 Documentation improvements
  • 💡 Ideas and suggestions

Get Started:

  1. Check the Contributing Guide
  2. Browse Open Issues

👥 Community

<div align="center">

Author

João Pereira
🌐 Website💼 GitHub

Contributors

Contributors

Show Your Support

Star this project if it helped you!
🐦 Share with your network
💬 Discuss your use cases

</div>


📄 License

Copyright © 2023-2024 João Pereira

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.


⚠️ Language Support

Important: This tool currently supports English only. The output of dotnet test may be localized, and if it is not in English, the tool may not function correctly.


<div align="center">

Made with ❤️ for the .NET community

DocumentationNuGetDocker Hub

</div>

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
4.1.0 23,764 3/24/2026
4.1.0-alpha.2 73 3/23/2026
4.1.0-alpha.1 59 1/14/2026
4.1.0-alpha.0 70 1/13/2026
4.0.0 132,309 1/13/2026
4.0.0-alpha.0 1,350 12/4/2025
3.4.0 39,214 12/4/2025
3.4.0-alpha.2 4,057 12/3/2025
3.4.0-alpha.1 624 12/1/2025
3.4.0-alpha.0 624 12/1/2025
3.3.0 12,285 12/1/2025
3.3.0-alpha.2 158 11/6/2025
3.3.0-alpha.1 151 11/5/2025
3.3.0-alpha.0 147 10/27/2025
3.2.0 44,781 10/27/2025
3.2.0-alpha.2 100 10/24/2025
3.2.0-alpha.1 105 10/24/2025
3.2.0-alpha.0 104 10/24/2025
3.1.1 77,256 8/11/2025
3.1.0 31,720 6/26/2025
Loading failed