Access a binded variable from different class c# ranorex

549 Views Asked by At

Iam using rest sharp in ranorex Hi I have created a folder called data providers and I have inserted module variables like this

string _fname = "";
[TestVariable(""afaf**********)]
public string fname
{
get { return _fname; }
set { _fname = value; }
}

I tried to access fname from different class like objectname.fname and it returns null.

CAn you please tell me how to get the value which is binded to fname from a different class?

1

There are 1 best solutions below

0
Manish On

One solution that I have used and that works is to create a global variable and bind it to the module variable and then in the testcase/module that you need that value, use the global variable which now is assigned with the value of the module variable.

You can do it like this

  1. Create global variable in the test suite- var_global

  2. Create module variable in module 1- fname

  3. In module 1, assign the module variable to global variable -

    TestSuite.Current.Parameters["var_global"] = fname

  4. Create a module variable in module 2 = var_mod2

  5. Use the global variable

    var_mod2 = TestSuite.Current.Parameters["var_global"]