Static binding of global variable to repository variable

Ranorex Studio, Spy, Recorder, and Driver.
tgroeger
Posts: 13
Joined: Wed Oct 16, 2013 12:43 pm

Static binding of global variable to repository variable

Post by tgroeger » Tue Apr 22, 2014 9:39 am

Hello everyone,

I'm in the process of automating a few tests in a web environment and have come across the need to be able to quickly substititute the URL of the page I'm running the test on with something else. I'm doing this mainly to be able to test differing versions of the same page located under different URLs.

I'd normally have to substitute the domain in the dom object, which is the root of my current repository, with a variable, or alternatively set the domain manually before each run. Since I want to to be able to run the tests under different domains automatically, I'm rather forced to use the first option.

The "problem" I'm having with that option is that I now have to bind the URL stored in a global variable in each and every test case to the variable I use for the domain in my repository. I'd like to avoid having to do that binding everytime and thereby avoid having every single recording showing up with bindings, even when generally no binding other than the domain is needed.

So I find myself wondering if there's a way to do something along the lines of direct or "static" binding which saves me the trouble of binding every single action and keeps those bindings from showing up in the Test Suite. As an example it would be great if you could bind a global variable directly to a repository variable.

Regards, tgroeger

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Static binding of global variable to repository variable

Post by krstcs » Tue Apr 22, 2014 1:48 pm

Unfortunately, that is not possible as Ranorex is not designed for bindings outside of the test cases.

I have the same issue, and that is exactly how I have solved it. Works like a charm once it's in place.


Remember, once you bind the variables one time you shouldn't need to do it again. It is a pain to do if you didn't start off that way, but once it's done, it's done.


One thing that will make it easier is consistent variable/parameter/data set naming. Always name the variable "Domain" and the Global Parameter "Domain". Then, you can just open each test case's data binding and click the "Auto Bind" button. Much easier that way as Ranorex handles the binding for you, as long as you have the same names on both (case-insensitive, so don't worry about upper/lower-case).
Shortcuts usually aren't...