Page 1 of 1

How repeat current test case

Posted: Mon May 20, 2019 7:35 am
by darpro
I have question, if there is possibility to repeat current test case, if we know that there is an problem with page loading.
I catch the exception when element not exist on page, right now I woul like not failed test case, but repeat this test case by defined by counter number (static variable). Is this possible in Ranorex, which method I can use? or maybe some article on blog?

Re: How repeat current test case

Posted: Mon May 20, 2019 7:55 am
by odklizec
Hi,

Have you tried auto retry feature?...
https://www.ranorex.com/help/latest/ran ... eautoretry

Re: How repeat current test case

Posted: Wed May 22, 2019 7:32 am
by darpro
I check it, and set up as described, but test case was not repeted.
Element was not exist on page, loader instead. Test case failed on try-catch exception
I would expect that this test case will be repeated.

try {
this.Element.WaitForExists(_DefaultTimeout);
} catch(Exception e) {
Log(ReportLevel.Failure, "Validation", "Element not found on page, this.Element);
}

Is there possibility to run method to repeat test case from code. e.g. in try-catch block?

Re: How repeat current test case

Posted: Wed May 22, 2019 8:22 am
by odklizec
Hi,

Have you tried to run your test with retry and without try-catch block? I think try-catch could be the reason, why the test is not repeated? As far as I know, there is no publicly available way to replay a test case from code.

Re: How repeat current test case

Posted: Wed May 22, 2019 10:10 am
by McTurtle
Hi darpro,

If only "Failure" is triggered in the module, then the retry should work despite the try-catch. However, if your code also has some other issue, then an "Error" could be triggered, some exception in the code. In this case, the retry will not work. "Error" and "Failure" are not the same thing. You can test this by changing the report level to "Error" in your code below. Are you sure that you don't also have some other exceptions in your code?

Regards,
McTurtle