Ranorex delay

Best practices, code snippets for common functionality, examples, and guidelines.
Grasspriet
Posts: 2
Joined: Thu Sep 28, 2017 2:33 pm

Ranorex delay

Post by Grasspriet » Thu Sep 28, 2017 2:45 pm

Hello support,

While running my Ranorex script, it shows the message that it is searching for an element for 2 seconds, but when the time is reached, it is still searching and clicks on the button after 5 seconds... So Ranorex finds the element, but there is a delay. This gives huge performance problems, because our application is tested every night for 10-12 hours. That means it is still busy in the morning when work starts. Can I somehow prevent the delays? It will also increase the performance of the faile testsuites we rerun in daytime.

Hope to hear!

Regards,
Grasspriet

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Ranorex delay

Post by krstcs » Thu Sep 28, 2017 9:36 pm

First, a 2 second delay is way too short. You should not change the delays from the default of 30s. Making the delay shorter does NOT make the test faster, it only makes the test FAIL faster because Ranorex doesn't have time to find the elements. The timeout value tells Ranorex how long to take when trying to find the element before it fails, it doesn't make Ranorex faster/slower.

Second, if no one is watching the tests, does it really matter how long it takes (within reason, of course)? 5 secs is not very long. The point of automation is not speed (that is a happy by-product, usually), it is consistency and the ability to run the tests any time without a user. This will usually result in faster testing cycles, but it shouldn't be the primary objective.

Third, Ranorex is a GUI automation system and moving the mouse, typing on the keyboard, and finding elements takes time. Now, it is usually faster than a human, but it still isn't instantaneous.
Shortcuts usually aren't...

Grasspriet
Posts: 2
Joined: Thu Sep 28, 2017 2:33 pm

Re: Ranorex delay

Post by Grasspriet » Fri Sep 29, 2017 8:31 am

Hi,

Probably I was not clear enough. In the dialogue when a Ranorex test is running, there is an indicator how long Ranorex is looking for a certain element on the page. But when the time is passed (according to the green bar), it still waits for like 2 seconds before clicking a button. The element is found, because the test still proceeds. Is it just because the green bar is not a complete indicator? Or can I change this somewhere in the settings? It is not only when the waiting time is 2 seconds, but also 5 or 10 or 15.

The problem is that we rerun the tests that failed at night. A single test in our case has a duration of approximately one hour. This is done during work time. At the moment the tests runned at night are expanding (now till 10 am), so we are looking for ways to make the tests faster. When investigating ways to improve the speed of the Ranorex test, I found this delay in our tests.

Regards,
Grasspriet

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Ranorex delay

Post by krstcs » Fri Sep 29, 2017 1:26 pm

Ranorex does have some built-in delays that you can customize if you are working in user-code, but I advise against it, mainly because it can cause other issues that are very hard to debug. Really, you should leave the timeouts alone unless you absolutely need to change them.

An hour long test seems to me to be way too long. You should try to break them up into small pieces that can be run independently. That way you can run more of them in parallel and get them done faster.

Part of the point of automation in modern, agile environments is to give the developers quick feedback on regression issues. Anything more than 15-20 minutes is too long in most projects. And if you are doing nightly tests, you still only have a limited amount of time to run the tests before you will have logistical issues.
Shortcuts usually aren't...

User avatar
N612
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: Ranorex delay

Post by N612 » Fri Sep 29, 2017 6:25 pm

Ranorex will perform an action on an element as soon as it is found. The green progress bar in the progress window is the total time Ranorex will take to find the object (set via the timeout property). After it has reached the timeout (100% green progress bar), the test will throw an exception that it could not find the element and fail.

Typically, your test should fail if the timeout has been reached - but I have seen similar behavior to what you are describing. It has happened to me when using extensive code to loop through many objects or when trying to find an element with an overly robust RxPath causing Ranorex to look through a ton of elements to find the correct one. From my observations, it appears the exception won't be thrown until Ranorex has caught back up and has processed everything, regardless of the timeout.

Do you use many code modules or mostly stick to the standard recording modules? Providing a compressed Ranorex report from one of these test runs might help us understand a little more what is happening.