How repeat current test case

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
darpro
Posts: 3
Joined: Tue Sep 25, 2018 10:15 am

How repeat current test case

Post by darpro » Mon May 20, 2019 7:35 am

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?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4918
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How repeat current test case

Post by odklizec » Mon May 20, 2019 7:55 am

Hi,

Have you tried auto retry feature?...
https://www.ranorex.com/help/latest/ran ... eautoretry
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

darpro
Posts: 3
Joined: Tue Sep 25, 2018 10:15 am

Re: How repeat current test case

Post by darpro » Wed May 22, 2019 7:32 am

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?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4918
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How repeat current test case

Post by odklizec » Wed May 22, 2019 8:22 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

McTurtle
Posts: 255
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: How repeat current test case

Post by McTurtle » Wed May 22, 2019 10:10 am

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