Page 1 of 1

Is there any way to rerun the failed test case?

Posted: Tue Feb 28, 2017 3:57 am
by Baitosenshi
Hi all,

I have encountered this issue but no solution.
Is there any way to rerun the failed test case?
Such as in a test case teardown part, I have judged the current test case is failed in advance, what should I do next to rerun this failed test case?. (Code is best).

Thanks

Re: Is there any way to rerun the failed test case?

Posted: Tue Feb 28, 2017 12:47 pm
by qwertzu
Hi Baitosenshi,

I would not recommend implementing such a workflow because this makes it hard to understand the structure of the test and doesn’t provide a good overview.
A better way would be to see if the case fails and if so, then check another test case in this Run Configuration. If the current case is successful, then uncheck the other test case, so that it won´t run.

Here is an example for the code:

Code: Select all

if (TestSuite.Current.GetTestCase(TestCaseNode.Current.Name).Status == Ranorex.Core.Reporting.ActivityStatus.Success)
			{
				TestSuite.Current.GetTestCase("TestCase2").Checked=true;
			}
			else
			{
				TestSuite.Current.GetTestCase("TestCase2").Checked=false;
			}
So, dependent on success or failure of TestCase1, TestCase2 will either be checked, or unchecked:

Re: Is there any way to rerun the failed test case?

Posted: Tue Feb 28, 2017 1:03 pm
by Baitosenshi
Hi qwertzu,

Really thanks for your suggestion, since I noticed that if rerun the failed test case, it could be lead to dead circle. I'll try to use the way you suggested.

Thanks,
btsh