Page 1 of 1

Quickly change path in repository of multiple items

Posted: Wed Apr 16, 2014 3:15 pm
by ElSticky
Is there a way to rename all paths in a faster way then doing 1 by 1?

For example I want to:
page/page/button
rename to:
?//?//button

But I need to do this 30 times or more, can you change this at once?

Re: Quickly change path in repository of multiple items

Posted: Wed Apr 16, 2014 3:34 pm
by krstcs
My recommendation would be to get your favorite text editor (I use Notepad++) and do a search and replace in the rxrep file (it's just XML). Most of the good editors will do regex search and replace.

NOTE: BE VERY CAREFUL WITH THIS, for obvious reasons. You could end up with an invalid file. I would recommend backing up your rxrep file before doing this.

Re: Quickly change path in repository of multiple items

Posted: Thu Apr 17, 2014 7:30 am
by ElSticky
Thanks for the idea, I think that'll workout fine.

I was also curious why the performance when using '?' is like 20 times slower. I'm trying to make the tests hybrid now for design changes but they perform a lot slower. Any tips to make it faster?

Re: Quickly change path in repository of multiple items

Posted: Mon Apr 21, 2014 2:49 pm
by krstcs
Anytime a wildcard (?) or optional element (//) is used, Ranorex has to search every possible path under the parent until it either (a) finds the element or (b) reaches the COMBINED search timeout.

So, for example, if you have the following structure:

Code: Select all

<dom>
  <body>
    <div>
      <div/>
    </div>
    <div/>
    <div>
      <div id='myDiv'/>
    </div>
  </body>
</dom>
You would have the following paths, in order of greatest to least potential search times:

/dom[@domain='test.mydomain.com']//div[@id='myDiv'] -> Will search EVERY child under dom, and each child's children, recursively (i.e., it will search the whole dom structure), until it finds a div matching the id 'myDiv', or the search times out.

/dom[@domain='test.mydomain.com']/body/?/div[@id='myDiv'] -> Will search the dom for a body tag, and each child under body, and each child's children, to ONE level depth ONLY (i.e., it will just search one level deep in the structure under the body tag), until it finds a div matching the id 'myDiv', or the search times out.

/dom[@domain='test.mydomain.com']/body/div/div[@id='myDiv'] -> Will search the dom for a body tag, then it will search that body tag for each div. Then in each div, it will search until it finds a div matching the id 'myDiv', or the search times out.

/dom[@domain='test.mydomain.com']/body/div[3]/div[@id='myDiv'] -> Will search the dom for a body tag, then it will search that body tag for the 3rd div, then it will search the 3rd div for the div with the id 'myDiv'. (Try not to use indexes if possible, as they can become volatile as the developers move things around in the SUT.)


So, try to make your paths as specific as possible.

NOTE: If you use a unique ID (div[#'myDiv'] it will find it much more quickly since the unique id is hashed in a way that makes it easier to find, so Ranorex doesn't need to search recursively. This is why you should always try to use unique ids when available.