Skip to content

joaoopereira/dotnet-test-rerun

Repository files navigation

dotnet-test-rerun

Status

1 6 3 5 8

Description

Unfortunately, there isn't a way with plain dotnet test to automatically rerun failed tests.
This tool is wrapper for the dotnet test that automatically reruns any tests with the outcome "Failed" until they pass or a maximum number of attempts has been reached. This is useful, for cases where tests may fail intermittently due to external factors such as network connectivity, database availability, or race conditions.
Please note that 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.

💻 Usage

📦 dotnet tool

dotnet tool install --global dotnet-test-rerun
test-rerun [somepathtodll] [OPTIONS]

🐳 docker image

docker run joaoopereira/dotnet-test-rerun [somepathtodll] [OPTIONS]

▶️ Arguments

argument description
path Path to a test project .dll file.

▶️ Options

option description
--filter Run tests that match the given expression.
--settings, -s The run settings file to use when running tests.
--logger, -l Specifies a logger for test results. Multiple values are allowed. (default: trx)
--results-directory, -r The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created.
--rerunMaxAttempts Maximum # of attempts. (default: 3)
--loglevel Log Level. (default: Verbose)
--no-build Do not build the project before testing. Implies --no-restore.
--no-restore Do not restore the project before building.*
--delay, -d Delay between test runs in seconds.
--blame Run the tests in blame mode.
--configuration, -c Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project.
--framework, -f Defines the target framework.
--verbosity, -v Sets the verbosity level of the command. Allowed values are quiet, minimal, normal, detailed, and diagnostic.
--deleteReports Delete the generated report files.
--collect Enables data collector for the test run. Example: --collect "Code Coverage" or --collect "XPlat Code Coverage"
--mergeCoverageFormat Output coverage format. Possible values: Coverage, Cobertura or Xml. It requires dotnet coverage tool to be installed.
--environment, -e Sets the value of an environment variable. Can be set multiple times.
--inlineRunSettings Allow the configuration of inline run settings.

Notes:

  • Sending /p: instructions to set property values is also allowed.

👤 Author & Contributors

👤 João Pereira

👥 Contributors

Contributors

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check the issues page.

Show your support

Give a ⭐ if this project helped you!

📝 License

Copyright © 2023 João Pereira.
This tool is licensed under GNU General Public License v3.0. See the LICENSE file for details.