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.
dotnet tool install --global dotnet-test-rerun
test-rerun [somepathtodll] [OPTIONS]
docker run joaoopereira/dotnet-test-rerun [somepathtodll] [OPTIONS]
argument | description |
---|---|
path |
Path to a test project .dll file. |
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.
👤 João Pereira
- Website: jo-pereira.com
- Github: @joaoopereira
👥 Contributors
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐ if this project helped you!
Copyright © 2023 João Pereira.
This tool is licensed under GNU General Public License v3.0. See the LICENSE file for details.