question

imuruser avatar image
imuruser asked George_Popovici edited

Pass variable as parameter to child test case in iTest

Hi

I have a test case with parameters lets say

"Node1/Node2/Node3 = 1

Node1/Node2a = 7"

I want to run the test case from a parent test and pass parameters to the child test that are defined in the parent. Let's say the parent has:

"A/B/C = a

X/Y = b".

I want to run child so that Node1/Node2/Node3 = a and Node1/Node2a = b.

In the parent test case I "set param1 [param A/B/C]" and "set param2 [param X/Y]"

But when I run it with the parameter list (defined in EXEC run properties) set to:

Node1/Node2/Node3=$param1

Node1/Node2a=$param2

then in the child test case the variables are not evaluated, meaning that it is run with $param1 (the name $param1, not the value in the variable named param1) and $param2.

I also tried with [get param1] and [gget param1]

Any ideas?

iTest
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

George_Popovici avatar image
George_Popovici answered George_Popovici edited

Hi @imuruser,

Just to be sure, in the parameter list (defined in EXEC run properties for the run child), do you have field substitution enabled? (The little square in the bottom left corner of the parameters field)

And, in the child test case, you will need to evaluate the parameter that was passed by doing:

set var_in_child [param Node1/Node2/Node3] and this should have value a.

Hope this helps.

Regards,

George

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

samobeslagic avatar image
samobeslagic answered

Hi @imuruser,

If I understand you correct then you call one test case (procedure in that test case) from another test case, right?

In this case you can pass variables from test case #1 to procedure in test case #2 via arguments in procedure.

Please see this example.

In the pictures above you can see that MainProgram is calling procedure runTest from another test case (Procedures). Also values (Node1 Node2 Node3 etc.) are passed via arguments at procedure call.

And then procedure runTest will write value of the arguments into Execution Flow.

Hope this answers your question :)

Regards,
Aleš


mainprogram.png (17.4 KiB)
procedures.png (25.1 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.