it's described pretty clear ("Lesson 3") how to "combine" them but... what exactly does that mean? does the binding have one direction? I'm asking because I created a global parameter and gave it a value, after wich I created a variable for a recording and performed the binding in a testcase - as I ran the TC, the variable was empty... am I missing some small print somewhere?
All the best!
D.
Global parameters - recordings' variables binding
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Global parameters - recordings' variables binding
Hi,
As the global parameters are set/saved in the Test Suite file you have to execute the whole Test Suite, otherwise Ranorex is not able to get the values of the global parameters out of the Test Suite.
Regards,
Markus
Ranorex Support Team
As the global parameters are set/saved in the Test Suite file you have to execute the whole Test Suite, otherwise Ranorex is not able to get the values of the global parameters out of the Test Suite.
Regards,
Markus
Ranorex Support Team
Re: Global parameters - recordings' variables binding
Hi Markus,
Thank you for the reply. Indeed, when running the suite, the bound variable gets the parameter's value. Your remark should be emphasized in the documentation.
What about the binding’s direction? What happens if I modify (in code) a variable (bound to a parameter)? What happens if I modify (in code) a parameter (is this possible?) to which a variable was bound?
All the best,
D.
Thank you for the reply. Indeed, when running the suite, the bound variable gets the parameter's value. Your remark should be emphasized in the documentation.
What about the binding’s direction? What happens if I modify (in code) a variable (bound to a parameter)? What happens if I modify (in code) a parameter (is this possible?) to which a variable was bound?
All the best,
D.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Global parameters - recordings' variables binding
Hi,
You can set or create global parameters at runtime, but you have to make it before the specific TestCase, where you have bound the variables, is called.
Markus
Ranorex Support Team
As module variables are normal properties you can also use them like properties. That means if you set the variable to another value (in code at runtime) the new value will be taken instead of the value of the global parameter.What happens if I modify (in code) a variable (bound to a parameter)?
This is possible but not recommended.What happens if I modify (in code) a parameter (is this possible?) to which a variable was bound?
You can set or create global parameters at runtime, but you have to make it before the specific TestCase, where you have bound the variables, is called.
TestSuite.Current.Parameters.Add("GlobalParam3", "30"); //creates a new one TestSuite.Current.Parameters["GlobalParam2"]="30"; //overrides the parameter with the specific name var testSuite = (TestSuite)TestSuite.Current; var testCase = (TestCase)TestSuite.Current.GetTestCase("TestCase"); var testSuiteModule = testCase.AllModules[0]; // the first module from the specific test case testSuiteModule.AddDataBinding(new ModuleVarItem("variable1", new Guid("07bef6aa-2cd3-4ac5-92de-ae42bc078ccf"), "Recording1", ""), new ParameterDataBindingInfo("GlobalParam3", testSuite.TestSuiteEntry.Id.ToString(), (TestCase)TestCase.Current));// the new data binding, variable1 is the variable from the specific recordingKind Regards,
Markus
Ranorex Support Team
Re: Global parameters - recordings' variables binding
Does this mean that binding is just an initialization (of the variable with the global parameter's value)?Support Team wrote: ... That means if you set the variable to another value (in code at runtime) the new value will be taken instead of the value of the global parameter.
The second part of your answer is unfortunately of no help to me.
My problem: I have a solution, with multiple projects (and hence multiple repositories). There are certain solution-relevant values which I set as "global parameters" (I would only need to read them, though writing would also help). I can do the global parameter - recording variable binding (which works just fine) but I'd have to create a variable every time I need a global parameter - not quite optimal.
Long story, short: what I basically need is a way to globally access some information/variables.
All the best!
D.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Global parameters - recordings' variables binding
Hi,
Markus
Ranorex Support Team
There are more ways to handle this, you can generate a C# Code file (static class or normal public as you like) where you can collect all your "global" parameters or you can directly access the "Ranorex global parameters" through this code:Long story, short: what I basically need is a way to globally access some information/variables.
IDictionary<string, string> idict = TestSuite.Current.Parameters;Regards,
Markus
Ranorex Support Team
Re: Global parameters - recordings' variables binding
Brilliant! Exactly what I needed
Thank you!
D.

Thank you!
D.
Re: Global parameters - recordings' variables binding
So, this code (with global variables) should be part of Program class? Or what is the right way?There are more ways to handle this, you can generate a C# Code file (static class or normal public as you like) where you can collect all your "global" parameters
Can you bring an example?or you can directly access the "Ranorex global parameters" through this code:IDictionary<string, string> idict = TestSuite.Current.Parameters;
Re: Global parameters - recordings' variables binding
this is how I did it:
with MyDomain defined as global parameter
Code: Select all
IDictionary<string, string> idict = TestSuite.Current.Parameters;
string PBDomain = idict["MyDomain"];
-
- Posts: 1
- Joined: Fri Nov 04, 2011 12:52 pm
Re: Global parameters - recordings' variables binding
Hi,
thank you, exactly what I'm looking for!
thank you, exactly what I'm looking for!