User code for update global parameters programatically

Ask general questions here.
praneet
Posts: 38
Joined: Thu Nov 08, 2018 2:22 am

User code for update global parameters programatically

Post by praneet » Fri Mar 01, 2019 8:56 am

I want to pass global parameter to several test cases. So could you post some code to manage/update global parameter values programatically in user code.

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

Re: User code for update global parameters programatically

Post by odklizec » Fri Mar 01, 2019 9:10 am

Hi,

You can access global parameters by code like this:

Code: Select all

//read
string globalParamValue = TestSuite.Current.Parameters["GlobalParamName"]; 
//write
TestSuite.Current.Parameters["GlobalParamName"] = "strvalue"; 
However, in my opinion, it's better to stick with variable/parameter binding instead of reading/writing parameters from code. Doing it form code could create a messy and hard to read/understand solution.
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