Hi,
I have a validation step that I like to delay a bit as the action before needs time to execute. So the element I need to verify on is already there, but the text changes after a short delay, and the new text is the one I like to verify.
Is it possible (without code) to delay a validation step (or any step in general) ? I'm not looking for an general delay time for all steps, but for individual steps.
Thanks
How to add a delay to a validation step
Re: How to add a delay to a validation step
found it myself right after hitting the submit button here.
There is the dedicated "Delay" action that does this job
There is the dedicated "Delay" action that does this job
Re: How to add a delay to a validation step
Hi,
I would suggest you to explore WaitForExists|NotExists action(code). Delay (no matter how long) could easily finish before the application is ready for next step. Additionally, adding too many hardcoded delays would make your tests (unnecessary) slower. WaitFor waits until the appearance/disappearance of an item (with timeout option). Hence WaitFor action is much better way of handling delays in tests.
I would suggest you to explore WaitForExists|NotExists action(code). Delay (no matter how long) could easily finish before the application is ready for next step. Additionally, adding too many hardcoded delays would make your tests (unnecessary) slower. WaitFor waits until the appearance/disappearance of an item (with timeout option). Hence WaitFor action is much better way of handling delays in tests.
Last edited by odklizec on Mon Nov 30, 2015 12:32 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: How to add a delay to a validation step
Thanks Pavel,
I didn't see the "WaitFor" action. I will use this and see whether this solves my delay problem
I didn't see the "WaitFor" action. I will use this and see whether this solves my delay problem
Re: How to add a delay to a validation step
I agree with Pavel that fixed delays are to be avoided wherever possible. A simple test can blow out to be very long with fixed delays as you'll end up coding your test to run with the delays set for the 'worst case scenario" (i.e. when the server is slow, the app is under load, or the VM is just running like a dog).
If there is a UI element that gives you a clear indication of when the screen has refreshed, then you can do a WaitForExists()/WaitForNotExists().
Alternatively, if the screen doesn't really change, but the content or attribute of an element is expected to change, then you could write a method that polls that UI element until the content/attribute changes to what you expect, or the timeout occurs.
If the expected content attribute is found, the loop ends early and you return with a success, otherwise if the timeout occurs, you fail or throw an exception.
When we applied this to some of our early Ranorex tests, we were seeing an average of 30% reduction in execution times, so its worthwhile doing.
If there is a UI element that gives you a clear indication of when the screen has refreshed, then you can do a WaitForExists()/WaitForNotExists().
Alternatively, if the screen doesn't really change, but the content or attribute of an element is expected to change, then you could write a method that polls that UI element until the content/attribute changes to what you expect, or the timeout occurs.
If the expected content attribute is found, the loop ends early and you return with a success, otherwise if the timeout occurs, you fail or throw an exception.
When we applied this to some of our early Ranorex tests, we were seeing an average of 30% reduction in execution times, so its worthwhile doing.