Increasing speed of script execution in ranorex

Ranorex Spy, Recorder, and Studio.
MPK
Posts: 1
Joined: Wed Sep 14, 2016 10:45 am

Increasing speed of script execution in ranorex

Post by MPK » Wed Sep 14, 2016 10:55 am

Speed of ranorex scripts can be increased by modifying the parameters of .cs file in recording module:

Keyboard.DefaultKeyPressTime = 0;
Mouse.DefaultClickTime = 0;
Mouse.DefaultMoveTime = 0

The problem with this is, since it is a designer file, the value gets reset every time the file is opened in ranorex studio.

Is there a way to implement the same in user code?

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

Re: Increasing speed of script execution in ranorex

Post by odklizec » Fri Sep 16, 2016 8:14 am

Hi,

You don't have to define anything like that in the user code. Just enable "Turbo mode" in Recording properties (or in recording table toolbar) and Ranorex automatically sets the minimum move/click values in recording cs file. Hope this helps?
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

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

Re: Increasing speed of script execution in ranorex

Post by krstcs » Fri Sep 16, 2016 1:15 pm

Also, there are a couple of things to understand:

1. Doing this can cause unexpected test failures due to not giving the system enough time to take actions. These can be hard to diagnose due to the seemingly random nature of the failures.

2. Functional test automation is not about speed, it is about consistency (which improves speed over human manual testing as a side benefit). It is fine to look for ways to speed up the test, but remember that speed should not be the end goal, consistent test execution should be.

My recommendation is to leave the settings the way they are and not worry about it. Your aren't going to see enough of an improvement to make it that big of a difference in most situations.
Shortcuts usually aren't...

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

Re: Increasing speed of script execution in ranorex

Post by odklizec » Fri Sep 16, 2016 1:36 pm

I just need to add my 2 cents and somewhat defend the Turbo mode ;) Usually, I would agree that enabling Turbo mode to make the tests faster is a very bad idea. However, I found that the Turbo mode could actually make the tests more stable (under certain circumstances)!

Some time ago, I got another VM, which I happily configured as yet another Jenkins slave. Bizarrely, my tests, so far rock solid on a physical machine, started to fail on this particular VM. And guess what, it was not because of enabled Turbo mode. In contrary, it was because of lack of there off! :) It looks as if the VM is so fast, that any artificial delay for mouse move/click causes problems. Once I enabled the Turbo mode in failing modules, the tests stabilized! And it works like that for few months. So yes, using Turbo mode to make the test faster is bad idea. But it could actually help in case of weird mouse move/(missed) click related issues.
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

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

Re: Increasing speed of script execution in ranorex

Post by krstcs » Fri Sep 16, 2016 1:43 pm

Pavel, I would suggest that that might be because you needed to turn off Async Dispatch... :D
Shortcuts usually aren't...

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

Re: Increasing speed of script execution in ranorex

Post by odklizec » Fri Sep 16, 2016 1:53 pm

Sadly no. I have it disabled for some time and neither disabled or enabled async. dispatching helped with this particular issue. The only thing that really helped was enabled Turbo mode. Strange, but it definitely solved the problem. But thanks for the suggestion! ;)
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

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

Re: Increasing speed of script execution in ranorex

Post by krstcs » Fri Sep 16, 2016 3:29 pm

I didn't say that it couldn't be helpful in some situations, just that I don't recommend it and that there are other factors to be aware of.

In this case, however, I have not seen any reason to believe that speeding up the test will help with consistency, and in fact MPK didn't mentioned consistency issues (please correct me if I'm missing something!).

I still think that, unless there is a very good reason for it, you should stay away from trying to speed up the test any more than Ranorex already does by default.



Since this is not actually a bug in Ranorex, it probably should not be posted in the Bug Reports forum area. This forum should be reserved for issues where Ranorex is not working as intended.

@Ranorex Support - Can we move this to the Automation Tools or Automation API forum area?
Shortcuts usually aren't...