To rerun failed tests in Dotnet Test, you can use the "--filter" option with the "FullyQualifiedName" attribute of the failed test. This will isolate the failed test and run it again.
Here's an example:
Run the Dotnet Test command to run all the tests:
dotnet test
The test results will show which tests failed. Take note of the FullyQualifiedName of the test that failed.
Use the "--filter" option to run only the test that failed:
dotnet test --filter "FullyQualifiedName=Namespace.ClassName.TestName"
Replace "Namespace.ClassName.TestName" with the FullyQualifiedName of the failed test.
The failed test will run again and the results will be displayed.
Note: You can also use the " --last-failed" option to run only the tests that failed in the last run.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-06-04 11:00:00 +0000
Seen: 1 times
Last updated: Nov 19 '22