Cleanup routine before test run

Ranorex Spy, Recorder, and Studio.
dmconsulting1
Posts: 91
Joined: Fri Nov 08, 2019 3:23 pm

Cleanup routine before test run

Post by dmconsulting1 » Mon Mar 16, 2020 4:49 pm

So if a previous build test fails, the installer or application might be in a funky state on the agent. I created a KillProcesses recording that does a series of KillProcess commands looking for one of 3 possible objects displayed prior to running a new installation. It works, but each step has a 0 second search timeout, so it takes a minute and a half to run, most of the time there isn't anything to kill. So it adds to the overall runtime.

I just tried pop up watcher for the same process, but even though it said it found and clicked on something, it totally didn't. Is there a faster/better way to do this, or a way to reduce the overall timeout that I am not seeing in the properties? Thanks.
Attachments
killProcesses.png
killProcesses.png (33.38 KiB) Viewed 204 times

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

Re: Cleanup routine before test run

Post by N612 » Mon Mar 16, 2020 9:27 pm

Maybe the element the popup watcher is looking for always exists but are just not visible? Try adding a "and @visible=true]" to the RxPath. If this does not resolve the issue, add a "Capture snapshot" action directly before the popup watcher usually clicks the element and run your test. In the report, there will be a snapshot you can use to see what Ranorex sees during execution and might explain why it is clicking something.

dmconsulting1
Posts: 91
Joined: Fri Nov 08, 2019 3:23 pm

Re: Cleanup routine before test run

Post by dmconsulting1 » Tue Mar 17, 2020 4:21 pm

The items are good when doing the install script, but I don't want them displayed otherwise. That's why I have this running prior. Also the uninstall fails if the app is running, so the clean up runs first to ensure everything is killed off so it can be removed. This script is kicked off by TFS as part of the build validation routine.

Maybe add the if visible to the kill process?

I will try a few different things, thanks a lot for the idea.

dmconsulting1
Posts: 91
Joined: Fri Nov 08, 2019 3:23 pm

Re: Cleanup routine before test run

Post by dmconsulting1 » Tue Mar 17, 2020 7:38 pm

Is there a way to shorten the timeout? 30 seconds seems excessive for this task.

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

Re: Cleanup routine before test run

Post by N612 » Tue Mar 17, 2020 8:55 pm

Timeouts can be shortened via the repository item's properties. Effective timeout is the timeout of itself and all parent items combined. This is the maximum amount of time Ranorex will look for the element. To avoid editing the timeout of all your elements, drag or copy this repository item outside of the root item and make it its own root item with its own timeouts that do not build off of parent items.

Timeouts: https://www.ranorex.com/help/latest/ran ... properties
Attachments
drag.png
drag.png (12.25 KiB) Viewed 176 times

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

Re: Cleanup routine before test run

Post by odklizec » Tue Mar 17, 2020 9:26 pm

Hi,

Instead of shortening repo element timeout, I would suggest to use Exists(time-out) method, as described for example here...
https://www.ranorex.com/forum/how-to-ch ... tml#p53064
So basically, you need to create a custom method, into which you pass the repo element of your choice and do whatever you want if it exists or not. And instead of waiting full effective timeout, you can skip the search with your own timeout.
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