Page 1 of 1

How to get different values in code module variable

Posted: Wed Mar 26, 2014 5:55 am
by bimal jose
Hi

I would like to know how to get different values for same code modules in a test case

The scenario is like below,

Test Case 1
Test step 1 (code module1) ---- value 1
Test step2 (code module 1) ----- value 2

Here I have two steps, say adding a filter and i have to add 2 filter I would like to call the same code module twice. But the values should be different.
There is a code module variable in the code module 1. (right click and select the option "Insert Module Variable")

How do achieve this scenario, can I use data binding here?

TIA
Bimal Jose

Re: How to get different values in code module variable

Posted: Wed Mar 26, 2014 1:20 pm
by krstcs
Yes, all you have to do is bind the different data columns to each instance of the test module.

How many times will you need this module to run? How many different variables?

Would it be easier to stick this module inside it's own test case and put each variable in a separate row of the data column? The test cases work like for-each loops, running all modules and child test cases once for each data row in the data connector given.

Re: How to get different values in code module variable

Posted: Thu Mar 27, 2014 5:07 am
by bimal jose
yes, Unfortunately this is not practical. When selecting more than 1 elements from the data column the data executed like a for-each loop. as per the above scenario, if select two variable in data column - in the first iteration value 1 applies to test step 1 and step step 2 and in second iteration value 2 applies to step 1 and step 2.

This is not the requirement. summarizing the requirement once again.
There should be only 1 iteration
each test step should have different value.

TIA
Bimal Jose

Re: How to get different values in code module variable

Posted: Mon Mar 31, 2014 12:25 pm
by Support Team
Hi,

You can also use the one module twice in one test case and bind the specific variable twice, to different data columns as shown below:
TestSuite.png
DataSource.png
DataBinding.png
Report.png
Regards,
Markus