π dotnet-test-rerun
Overview
dotnet-test-rerun is a powerful wrapper for dotnet test that automatically reruns failed tests until they pass or reach a maximum number of attempts. This tool is essential for handling intermittent test failures caused by external factors such as:
- Network connectivity issues
- Database availability
- Race conditions
- Timing-dependent tests
- Resource contention
Key Features
- π Automatic Retry: Automatically reruns failed tests with configurable retry attempts
- π― Selective Rerun: Only reruns failed tests, not the entire test suite
- π Test Reporting: Supports standard dotnet test loggers (trx, junit, etc.)
- π³ Docker Support: Available as Docker images for .NET 8.0, 9.0, and 10.0
- π¦ Global Tool: Easy installation as a dotnet global tool
- π§ Highly Configurable: Extensive options for filtering, logging, and test execution
- π Code Coverage: Support for code coverage collection and merging
- β‘ Performance: Efficient execution by targeting only failed tests
Quick Start
Installation
Install as a global dotnet tool:
dotnet tool install --global dotnet-test-rerun
Basic Usage
Run tests with automatic retry:
test-rerun path/to/test.dll
Run with custom retry attempts:
test-rerun path/to/test.dll --rerunMaxAttempts 5
Why Use dotnet-test-rerun?
Unfortunately, there isnβt a built-in way with plain dotnet test to automatically rerun failed tests. This tool fills that gap by:
- Reducing False Failures: Automatically handles transient failures without manual intervention
- Saving Time: No need to manually rerun failed test suites
- CI/CD Optimization: Makes CI/CD pipelines more resilient to intermittent issues
- Better Test Metrics: Distinguish between truly failed tests and transient failures
Language Support
β οΈ Important: This tool is language-dependent. The output of dotnet test may be localized, and if it is not in English, the tool may not function correctly. Currently, only English is supported.
Navigation
- Installation Guide - Detailed installation instructions for various scenarios
- Usage Guide - Comprehensive usage documentation and command-line options
- Configuration - Configure test execution, retry behavior, and more
- Examples - Real-world examples and use cases
- Docker Guide - Using dotnet-test-rerun with Docker
- Contributing - How to contribute to the project
Support
- π Report Issues
- π GitHub Repository
License
This tool is licensed under GNU General Public License v3.0. See the LICENSE file for details.
Author
JoΓ£o Pereira
- Website: joaoopereira.com
- GitHub: @joaoopereira
Give a β if this project helped you!