Retries After Initial Failure

Ranorex Spy, Recorder, and Studio.
jmckinstry
Posts: 18
Joined: Mon Sep 30, 2013 5:01 pm

Retries After Initial Failure

Post by jmckinstry » Fri Apr 30, 2021 9:24 pm

In my test case, I am opening up a URL and it can either load correctly, or load a page with the title "Automation Error". I am looking at a <h3> tag to see if the Automation Error page is laded using the following in a code module:

Code: Select all

if(Validate.NotExists(repo.ApplicationUnderTest.Alert_Box_Components.Automation_Error_Page_HeadingInfo,null,true));
If the error page is loaded, the test will fail and go to the next iteration.

Everything works as expected except it does 28 retries which takes 7 seconds. How can I tell it to stop after say 2 tries? I would like it to just fail and go to the next iteration. Here is the message that I get in the report:

Element for item 'All_DNIS_TST_OutcomeRepository.ApplicationUnderTest.Alert_Box_Components.Automation_Error_Page_Heading' does not exist (Failed to find item 'All_DNIS_TST_OutcomeRepository.ApplicationUnderTest.Alert_Box_Components.Automation_Error_Page_Heading'. Please check that your whitelist allows Ranorex to access the process. No element found for path '/dom[@domain='agentwebtest' or @domain='agentwebdev']//div[#'content']//h1[@innertext='Automation Error']' at step 'descendant-or-self::h1[@innertext='Automation Error']' after 28 attempts within 7s (timeout factor = 0.2).).

Thanks for your help!

EDIT: I have the Retry count set to 0 on the testcase - if that helps.

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

Re: Retries After Initial Failure

Post by odklizec » Mon May 03, 2021 10:41 am

Hi,

To shorten the search timeout, you can use 'Duration' parameter. The code should look like this...

Code: Select all

if(Validate.NotExists(repo.ApplicationUnderTest.Alert_Box_Components.Automation_Error_Page_HeadingInfo.AbsolutePath,5000,null,true))
I would personally recommended to pass the repo element to code via method parameter, instead of hardcoding repo element directly in code:

Code: Select all

public void GetXpathFromRepoItemInfo(RepoItemInfo repoInfoElement)
{
    if(Validate.NotExists(repoInfoElement.AbsolutePath,5000,null,true))
    {
    ...
    }
} 
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

jmckinstry
Posts: 18
Joined: Mon Sep 30, 2013 5:01 pm

Re: Retries After Initial Failure

Post by jmckinstry » Mon May 03, 2021 2:24 pm

Thank you very much for your help. I believe that this is just what I am looking for. Especially putting it all into a method.

Jeff