Is there any way to rerun the failed test case?

Ask general questions here.
Baitosenshi
Posts: 4
Joined: Mon Feb 27, 2017 8:55 am

Is there any way to rerun the failed test case?

Post by Baitosenshi » Tue Feb 28, 2017 3:57 am

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

qwertzu
Posts: 180
Joined: Wed Jan 25, 2017 11:08 am

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

Post by qwertzu » Tue Feb 28, 2017 12:47 pm

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:
Attachments
CatchFailedTest.png
CatchFailedTest.png (5.02 KiB) Viewed 478 times

Baitosenshi
Posts: 4
Joined: Mon Feb 27, 2017 8:55 am

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

Post by Baitosenshi » Tue Feb 28, 2017 1:03 pm

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