Replace items in repository for identical website

Ranorex Studio, Spy, Recorder, and Driver.
cdmartinus
Posts: 8
Joined: Wed Jul 03, 2013 11:21 am

Replace items in repository for identical website

Post by cdmartinus » Wed Jan 29, 2014 11:35 am

Hi all,

I have created a series of tests for the live version of a particular site, however I also want to run them on both the UAT and SYS versions of the site that we use for testing however the web addresses for all 3 sites are slightly different, with the additon of 'sys' or 'uat' to the web address e.g.

LIVE = https://www.test-site.com
SYS = https://sys.test-site.com
UAT = https://uat.test-site.com

This means that the tests I created for the Live site won't work on either the Sys or UAT versions. Everything is identical except the website name. Is there anyway for me to either get the same set of tests to work on all 3 sites, or create 2 more sets of identical tests that use the same repository items from each of the other sites?

Thanks!

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Replace items in repository for identical website

Post by Swisside » Wed Jan 29, 2014 1:37 pm

Hi !

If everything is exactly the same (including the repository items) you can do it quite simply :)

Steps :

1) Put all the tests that need to be done in a Test Case (Or do the steps below for all the existing test cases :))
2) Add a new data source (let's say an excel sheet)
3) In the Excel sheet create a column named WebsiteName (for instance) then add one line for each of the your websites' names (three lines in your case)
4) Add a module variable in the module(s) for which you want to repeat the steps
5) Right click the test case and bind the variable to the data source column WebsiteName.


Hope this is what you were looking for !


Regards

Swiss'

EDIT: After reading your question again I'm not sure my solution is what you need. Do you need to have the repository items changed according to the website name?
A simple thank you always does wonders !

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

Re: Replace items in repository for identical website

Post by krstcs » Wed Jan 29, 2014 3:25 pm

cdmartinus wrote:Hi all,

I have created a series of tests for the live version of a particular site, however I also want to run them on both the UAT and SYS versions of the site that we use for testing however the web addresses for all 3 sites are slightly different, with the additon of 'sys' or 'uat' to the web address e.g.

LIVE = https://www.test-site.com
SYS = https://sys.test-site.com
UAT = https://uat.test-site.com

This means that the tests I created for the Live site won't work on either the Sys or UAT versions. Everything is identical except the website name. Is there anyway for me to either get the same set of tests to work on all 3 sites, or create 2 more sets of identical tests that use the same repository items from each of the other sites?

Thanks!
Actually, all you need to do is VARIABLIZE your WebDocument's RanoreXPath. I do this on my sites.

Let's say your webdoc looks like this in the repo:

MyTestSite -- /dom[@domain='www.test-site.com']

Just add a variable to the repository called "Domain" and set the DEFAULT value (this value will be used when there is no data bound to the variable) to "uat.test-site.com" (or whichever one you normally use).

Then change your XPath to:

MyTestSite -- /dom[@domain=$Domain]

Now, whenever your tests look for the object "MyTestSite" they will use the variable Domain to match the domain attribute.

Then, just add the variable "Domain" to your global parameters (right click the test suite name in the test suite display and select Global Parameters). You can then pass in that parameter at the command-line using the "/pa:<parameter>=<value>" switch. EDIT TO ADD: You also need to "BIND" the parameter to your variables. See the user guide for information on all of this.

This is the power of data-driven testing in conjunction with the repository.
Shortcuts usually aren't...