Repository Items and Multiple Test Servers

Ranorex Studio, Spy, Recorder, and Driver.
AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Repository Items and Multiple Test Servers

Post by AccidentReport » Fri Sep 13, 2013 8:21 am

Forgive me if I'm missing the obvious on this one but I'm getting myself confused with too many things to do so wanted a clear answer from people who know!

My project has two web servers. One is used to test new developments and one is used to test bug fixes to the last released build. Let's call these servers www.server1.com and www.server2.com.

Now, I have built a number of tests on www.server1.com and these run absolutely fine. I now want to run the same tests on www.server2.com so I change the URl the tests open and run it. It fails. Now this is because it can't find the reposiotry items it is looking for as it expects them to be within a parent called www.server1.com. I have two questions:

1. How do I change the repository items to understand that www.server2.com is the same as www.server1.com?

2. Can I make the repository items generic so it doesn't matter which server I am running them on?

Thanks in advance!

fimo420
Posts: 55
Joined: Wed Jun 20, 2012 9:49 am

Re: Repository Items and Multiple Test Servers

Post by fimo420 » Fri Sep 13, 2013 10:54 am

Hi,

Im no expert on ranorex yet, but the way i've solved it is to have a variable on the repository item and then set the variabel at the beginning of each test or on a config file so that it works. Set a variabel on the dom level and then all the childs should work fine.
I think you can look into this post: http://www.ranorex.com/forum/repository ... t3043.html

AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Re: Repository Items and Multiple Test Servers

Post by AccidentReport » Fri Sep 13, 2013 11:09 am

Thanks. I'll have a look and see if that helps. If so i'll let you know.

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

Re: Repository Items and Multiple Test Servers

Post by krstcs » Fri Sep 13, 2013 4:41 pm

You top level DOM object in the repository should have a variable (looks like "$variableName") in it like:

Code: Select all

MyWebsite = "/dom[@domain=$testDomain]"
Then, you need to add a Global Parameter to the Test Suite, by right-clicking the test suite NAME in the test suite itself. Select "Global Parameters". Create a new parameter with the name "testDomain" spelled the same as the repository object's variable (without the "$"). Enter the value you want (this is the value you would change for the different tests) and click "OK".

Then, right-click the test modules (or the parent test case) for each module that has an unbound variable and select "Data Bindings". Click "Auto Bind" and check to make sure the variables are bound correctly. Manually bind any that have different names than the data source. Click OK.

Then you should be able to run your test and it will look for the domain that you put in the Global Parameter in order to find your items.

I would also suggest that you parameterize your URL to use a Global Parameter. These can be over-ridden at run-time using a command-line switch so you can have a batch file for site 1 and another for site 2.
Shortcuts usually aren't...