Refer module variable from another module

Ask general questions here.
User avatar
sandamal
Posts: 28
Joined: Wed Jul 08, 2015 7:50 am

Refer module variable from another module

Post by sandamal » Mon Jun 13, 2016 9:05 pm

Hi , im trying on this for some time and still need some help.

my test case will call a code module and then a record module.

I will use the code module to generate a specific ID using some logic.
and i need to use that id (that variable inside code module) within next record module input sequence.

is this doable.

I found similar method here http://www.ranorex.com/blog/sharing-dat ... o-another/ but not serving my requirement.

is this doable. ?


string _passMe = logic x+ y ;
[TestVariable("EA39090F-0F33-46F7-BEE5-61051670B5C9")]
public string passMe
{
get { return _passMe; }
set { _passMe = value; }
}

can i call get { return _passMe; } from another code module.

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

Re: Refer module variable from another module

Post by krstcs » Mon Jun 13, 2016 9:12 pm

You COULD, but you should not, for a number of reasons, most importantly:

You would have to instantiate the external recording module. Instantiating the recording module in another module would require that you pass in the variable value, which means you would already have to know it, so you wouldn't need to get the value again...

In other words, don't do it that way. If you need a value, you should always be getting it from a data source or parameter, not from another recording module. If you need to pass data between modules, you should create a parameter (at a level that both modules can see it) and bind/map it to both modules. The first module would change/set it, the second would use it.


So, please tell us what your goal is for this whole situation. We may be able to help you find out a way to do this better.
Shortcuts usually aren't...