I have few test cases for Web Site UI Automation.
I want to try my test case at least three times, if it fails for first and second time. That way, I want to make sure that this test case is failing consistently.
Please let me know, if we have any option to use in NUnit. I am using C# with NUnit.
For every failed test, write the test case name including the containing class name and the namespace to a file. Using nunit-console.exe, rerun the whole spec dll but filtered by that text file, so NUnit will run only the failed tests.
RepeatAttribute is used on a test method to specify that it should be executed multiple times. If any repetition fails, the remaining ones are not run and a failure is reported.
The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.
You can add a new attribute in the nunit based on the attribute repeat and rebuild the library. It's very simple.
[Test]
[Repeat( 25 )]
public void MyTest( ){
// your test logic here
}
Starting with NUnit 3.0, there is a 'Retry' attribute that looks like it will do exactly what kumar wants.
See Retry Attribute
[Test]
[Retry(3)]
public void MyTest( ){
// your test logic here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With