Page 1 of 1

How can I use Global parameters outside the Test Suit

Posted: Wed Sep 16, 2015 1:57 pm
by tanu08
Summary :- How can I use Global parameters outside the Test Suit.

In my case I have created a Class to open DB connection and close DB connection. Where I have configured a Connection String (hard coded).
This is not inside my test suite but inside Solution.
I use this class to get connection from DB in a code module where my Validation logic resides.
Here the tedious task is when I want to change my DB server( in connection String), I always have to go inside the Class (where I hard coded this connection string) and change it there. I want to make this scenario dynamic.
So I created a Global Parameter on Test Suit (solution) level (by default Ranorex Global parameter functionality).
But I am unable to access this global parameter in the DB class. So I am unable to bind this global parameter in DB connection class.
Can I implement this in some ways ?? Or do we have any other way around ?

Re: How can I use Global parameters outside the Test Suit

Posted: Wed Sep 16, 2015 2:27 pm
by odklizec
Hi,

In my opinion, the best way to achieve what you want is via Data Driven approach.

Instead of using Global Parameters, you should create a new data connector(CSV, Excel or SQL format), containing the required connection data. Then in you code module, you should create some variables, ideally, using the same names as used for data connector column names. These module variables should be then connected to the data connector. This way you can create multiple data connectors, which could be used within various test cases.

Below you can find somewhat more detailed explanation of Ranorex Data Driven approach...
http://www.ranorex.com/support/user-gui ... sting.html
http://www.ranorex.com/support/screencasts.html#c3896