πŸ”„ dotnet-test-rerun

Build Status Coverage Status NuGet Version NuGet Downloads Docker Pulls

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:

  1. Reducing False Failures: Automatically handles transient failures without manual intervention
  2. Saving Time: No need to manually rerun failed test suites
  3. CI/CD Optimization: Makes CI/CD pipelines more resilient to intermittent issues
  4. 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.

Support

License

This tool is licensed under GNU General Public License v3.0. See the LICENSE file for details.

Author

JoΓ£o Pereira

Give a ⭐ if this project helped you!


Back to top

Copyright © 2023-2024 JoΓ£o Pereira. Distributed under the GNU General Public License v3.0.