Mass change of repository item

Ranorex Spy, Recorder, and Studio.
Tnimni
Posts: 49
Joined: Thu Jan 02, 2014 4:03 pm

Mass change of repository item

Post by Tnimni » Thu Aug 07, 2014 7:19 am

Hi,

I had 20 objects in my Repository that needed to be changed

i.e. they used to be somthing like

Code: Select all

/element[@caption='1']/element[@caption='Rights']/button[@text='Ok']
problems is that i recived a new version of the applicaion and now it say "Right" insted of "Rights"

obviously if i had the

Code: Select all

 /element[@caption='1']/element[@caption='Rights'] 
part under a Folder and each element had only the last part attached to it i could do the change in only one place.

but i didn't, so what i wanted to do it to create Folder put

Code: Select all

 /element[@caption='1']/element[@caption='Rights' or @caption='Right'] 
in it, than drag all the other elements to that folder and delete the

Code: Select all

 /element[@caption='1']/element[@caption='Rights'] 
part from them.

i wanted to be smart and not do it manually for each and every item, so i went into the repository .cs file and did a Find and Replace for

Code: Select all

 /element[@caption='1']/element[@caption='Rights'] 
with a black string.

that worked fine, but when i re-complied the project, the string i removed went back in, so i had to manaully change each and every item.

1. how and why did the string i removed came back after compilation?
2. is there a way to do it directly from the code like i wanted?
3. is there a way to do such a mass change via the GUI?

Kind Regards,

Tnimni

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

Re: Mass change of repository item

Post by krstcs » Thu Aug 07, 2014 1:14 pm

You have to change both the .cs and the .rxrep files.

I would suggest that you not edit the files manually though as it can cause issues.


If all of the objects you are needing to edit have similar paths, just create a folder that has the same path as the part that is similar in the objects. Then move all of the objects under that folder and change the folder's path after all of the items are moved.

For example, if you have the following repo objects:

FirstNameField -> /container/container/container/text[@id='firstNameField']
LastNameField -> /container/container/container/text[@id='lastNameField']
OKButton ->/container/container/container/button[@id='OKButton']


You can create a rooted folder in the same place with the following path:

NameFolder -> /container/container/container

Now just drag and drop the first three items into the NameFolder and then adjust the path of the name folder how you want it.
Shortcuts usually aren't...

Tnimni
Posts: 49
Joined: Thu Jan 02, 2014 4:03 pm

Re: Mass change of repository item

Post by Tnimni » Mon Aug 11, 2014 4:23 pm

Hi,

thank you for your replay,

I did that, but i had to manually change the path of the items in the folder.

should they change automatically?

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

Re: Mass change of repository item

Post by krstcs » Tue Aug 12, 2014 1:31 pm

If you created the folder's path to exactly match the part of the item paths that are the same, then the item paths should have changed automatically when you dropped the items in the folder. However, I have found that it doesn't always work exactly the way it should due to minor differences (like one having a leading "/" and the other not.

The bigger thing to remember though is that now that you have fixed this once, you shouldn't have to do it again unless something in the application changes dramatically (like items being removed or changed in ways that would break the tests anyway).
Shortcuts usually aren't...