1

I have a keyword which checks, if a button value is Completed, once it is found, I want that keyword to stop and return the status. However the the button value Completed is not fixed to any time interval. I want to call the keyword recursively to check for value of button at every 3 minutes.

*** Test Case ***
   Navigate to menu    Home  Status
   #Something here to call the keywrod `Check run status` for every 3 
   minutes until ${passd} is true or 30 minutes are passed. 


***Keywrod***
 Check run status
${btnValue}  Get Text   //button[@id="btn_status"]  
${passed} =   Run Keyword And Return Status   Should be Equal   ${btnValue}   
Completed   
[Return]   ${passed}

How to iterate this with time interval & How can we achieve this with robotframework?

  • 2
    Do you want to apply recursion indeed or just repeat some actions? – wec Oct 7 at 11:13
3

You could use Wait until keyword succeeds The keyword will repeat executing until it succeeds you can specific the time to repeat the keyword like so

*** Test Case ***
Repeat Keyword Test
   Navigate to menu    Home  Status
   ${status} =  wait until keyword succeeds  30 minutes  3 minutes  Check run status


***Keywrod***
Check run status
  ${btnValue}  Get Text   //button[@id="btn_status"]  
  ${passed} =   Run Keyword And Return Status   Should be Equal   ${btnValue}  Completed      
  [Return]   ${passed}
0

I am not sure if you want to use Robot for status monitoring, but have you tried:

Loops: https://stackoverflow.com/questions/36328595/how-to-write-a-loop-while-in-robot-framework

Or invert the result and use to repeat if failed: http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Wait%20Until%20Keyword%20Succeeds

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.