Global parameters

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

Global parameters

Post by sandamal » Tue Jun 07, 2016 1:59 pm

Hi,

This is a basic question to understand the link between Global parameters and module variables.

my understanding is

1 ) we can create Module variables under each module. and that variable is accessible only within that record module.

2) we can add Global parameters by right click on test suit > global parameters and set a default values for those.

3) By right click on test case >> data binding ; we can map module variables in to global parameters. ( if we run individual record module it pics the default value of global parameter as value. )

so can we assign more than one module variable in to same global parameter in different modules ?

when we right click on test suit and take global parameters how can we map module variables at that level (through that window).

is there a clear reference to understand this ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Global parameters

Post by odklizec » Tue Jun 07, 2016 2:36 pm

Hi,
sandamal wrote: 3) By right click on test case >> data binding ; we can map module variables in to global parameters. ( if we run individual record module it pics the default value of global parameter as value. )
Nope. You must always run whole test suite, if you want Global Parameters values to be used in linked module variables. If you run individual recording/code module (outside Test Suite), there will be used default values defined in module variable (if there are defined default values). Basically, Global Parameters are not available outside Test Suite.
sandamal wrote:so can we assign more than one module variable in to same global parameter in different modules ?
Absolutely! You can link as many module variables to a Global Parameter as you have defined in your modules. You just have to go to the test case, which contains recording/code modules with variables and link the module variables to Global Parameters of your choice from here (Test Case >> Module).
sandamal wrote:when we right click on test suit and take global parameters how can we map module variables at that level (through that window).
At this level, you can only map the variables from modules placed in Test Suite Setup/Teardown section. Variables from modules placed in individual Test Cases must be linked from within these TestCases.
Last edited by odklizec on Tue Jun 07, 2016 2:39 pm, edited 2 times in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: Global parameters

Post by krstcs » Tue Jun 07, 2016 2:37 pm

Any parameter (global or test-case) can be mapped to any module variable.

This mapping happens AT THE MODULE, not at the parameter level, so you have to map the variable to the global parameter at the module's level (by right-clicking the module or the module's test case and selecting Data Binding). In this way, you can map any global parameter to any module variable. You can also map any test case parameter (or data connector column) that is in the DIRECT ANCESTOR CHAIN of the module to the module variable.

So, think of it this way: You are taking a module variable and selecting which parameter or data column in its ancestor chain will be used to fill it.


So, say you have the following structure:

TEST SUITE (Global Paramaters: MyGP1=Test1, MyGP2=Test2)
--TestCase1 (Parameters: MyTCP1=Case1Test1; Data Connector: MySimpleDataConnector (Columns: Col1, Col2)
----Module1 (Variables: ModVar1, ModVar2)
----Module2 (Variables: ModVar1, ModVar3)
--TestCase2 (Parameters: MyTCP2=Case2Test1; Data Connector: MySQLDataConnector(Columns: SQL1, SQL2)
----Module3 (Variables: ModVar4, ModVar5)

In this case, Module 1/2's variables can be mapped to MyGP1, MyGP2, MyTCP1, or Col1/Col2 of the data connector. Module 3's variables can be mapped to MyGP1, MyGP2, MyTCP2, or SQL1/SQL2 or the sql data connector.

Module 1/2's variables cannot be bound to MyTCP2 or the SQL data, and Module 3's variables cannot be bound to MyTCP1 or the simple data connector's columns (Col1/Col2).

It is a hierarchical relationship tree. Variables can only be bound to parameters or data connectors in their parent chain.

Also, you can have test cases inside test cases, and the same applies. The child test case's modules all have access to all of their parent's and ancestor's parameters and data connectors.
Shortcuts usually aren't...