How to get different values in code module variable

Ask general questions here.
bimal jose
Posts: 4
Joined: Thu Mar 14, 2013 6:36 am

How to get different values in code module variable

Post by bimal jose » Wed Mar 26, 2014 5:55 am

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

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

Re: How to get different values in code module variable

Post by krstcs » Wed Mar 26, 2014 1:20 pm

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.
Shortcuts usually aren't...

bimal jose
Posts: 4
Joined: Thu Mar 14, 2013 6:36 am

Re: How to get different values in code module variable

Post by bimal jose » Thu Mar 27, 2014 5:07 am

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

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

Re: How to get different values in code module variable

Post by Support Team » Mon Mar 31, 2014 12:25 pm

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
You do not have the required permissions to view the files attached to this post.