Global Variables

Ask general questions here.
maxABSciex
Posts: 4
Joined: Thu Dec 08, 2011 6:10 pm

Global Variables

Post by maxABSciex » Tue Dec 13, 2011 6:19 pm

Hello,

I believe similar questions have been asked before, but I could not find the specific answer I need.

I have created some Recording modules which I reuse in multiple Test Cases. Some of these Recordings have variables that can be bound. So far I have been binding them to either Global Parameters or Simple Data Sources within each Test Case. All of these are predefined constants.

Now this works very well and is pretty clean, but the problem lies here:
I will be testing my application on different computers, and hence different computer names. Which I will need to pass dynamically into these Recording modules.

So I was thinking of creating a Global Parameter called 'CompName' assign its value 'TBD', bind this Parameter to whatever variables I need, and then have some code somewhere set CompName to the appropriate string depending on the actual computer name...

I have not figured out a way of doing this. Where would I put the code and how would I modify the Global Parameter? Is there a better way?

Thank you for your help.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Global Variables

Post by Support Team » Wed Dec 14, 2011 9:17 am

Hello,

you can write your "code" (described in your post) in a CodeModule. This Code Module can be used like an RecorderModule wherever you want.

To insert a Module Variable in a code module, do a click with the right mouse button in the code and select Insert Module Variable.
The variable could be bound like variables within RecorderModules.

To do e.g. some initialization, execute the CodeModule with the initialization code before starting your SUT (System under Test).

Information about working with code are available here.

If you want to set variables to different values depending on the computer you start it on, you can use command line arguments as described in this topic of the Ranorex User Guide.

Regards,
Martin
Ranorex Support Team

pramoodd
Posts: 13
Joined: Tue Mar 26, 2013 8:45 am

Re: Global Variables

Post by pramoodd » Thu Apr 18, 2013 12:55 pm

HI admin,
I wanna make a global variable in code . and access all the local variables of all the modules (Test modules).

is there any possibility in achieving that?


thanks and Regards,
Praneeth Arnepalli

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Global Variables

Post by Support Team » Thu Apr 18, 2013 6:49 pm

Hello,

You can use global parameters in order to make the trick!
Please read the section Combining Variables with Parameters in order to get more information how to use global parameters.

Regards,
Bernhard