How can I use Global parameters outside the Test Suit

Bug reports.
tanu08
Posts: 4
Joined: Mon Jun 03, 2013 8:10 am

How can I use Global parameters outside the Test Suit

Post by tanu08 » Wed Sep 16, 2015 1:57 pm

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 ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Wed Sep 16, 2015 2:27 pm

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
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration