How to use global variables in new Ranorex 3.x

Ask general questions here.
User avatar
slavikf
Posts: 104
Joined: Mon Sep 13, 2010 9:07 pm
Location: Toronto, Canada
Contact:

How to use global variables in new Ranorex 3.x

Post by slavikf » Wed Sep 14, 2011 9:37 pm

With all that new structure introduced in Ranorex 3.0,
how i work with Global variables?

For example, in one test case, i'll get path of some file.
Then, in every test case after that, i want to use that path. How and where should i declare that global variable, so that it is available from user code in every test case?

BTW, i do not need any binding.

dman
Posts: 64
Joined: Mon Aug 29, 2011 9:33 am
Location: München

Re: How to use global variables in new Ranorex 3.x

Post by dman » Thu Sep 15, 2011 8:46 am

I'm also interested in this topic (have basically the same problem http://www.ranorex.com/forum/global-par ... tml#p10434) and I would be grateful for a solution to this matter.

All the best,
D.

dman
Posts: 64
Joined: Mon Aug 29, 2011 9:33 am
Location: München

Re: How to use global variables in new Ranorex 3.x

Post by dman » Thu Sep 15, 2011 10:05 am


Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: How to use global variables in new Ranorex 3.x

Post by Pixi6s » Tue Oct 11, 2011 1:54 pm

Wouldn't it be easier to use the repository variables, at least if you are using the repo in general.

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: How to use global variables in new Ranorex 3.x

Post by Todor » Tue Oct 11, 2011 2:25 pm

Using Global Parameters is very easy. First you have to create them (i hope you know how you do that) and then you'll have to bind them to a variable.

Assign the global parameter to the variable you want to run with the fortune value of the global parameter.

To use it in your test you will have to start your Test per commandprompt

1.) open the cmd
2.) <path to the executable test> /pa: <name of global parameter>=<value of the global parameter>
3.) execute the command

For not always opening the command prompt you can wirte a batch file to execute your test:

Code: Select all

@echo off

<path to your executable test> /pa: <name of global parameter>=<value of the global parameter>
Or you can simply use the default value of the parameter. Works fine too.

if you have more than one global parameter, just add another /pa: <name>=<value>