Page 1 of 1

How to execute multiple iteration

Posted: Tue Oct 06, 2015 11:48 am
by upendra
TESTSUPP TESTLOC TESTITEM TESTPOQTY
1199100 50 10060254 50
10116850 60
1038100 5 10010769 70
hi my excel file is like above .I want to execute for each supplier and loc i want to use multiple items.
e.g for first iteration , the supplier is 1199100 and loc 50 i want use two test items and then for second iteration , the supplier is 1038100 and loc 5 there will be single or more item. is this doable , if yes then how?
i am able to execute with single supplier with multiple items but i want to execute multiple supplier with multiple items.
I am able to execute multiple supplier with multiple items but for that i need to define more variable in the script.
i.e if there are three items i need to define three item variables in the script.
But i don't want to use specific items, i want to user more than one items with declaring only one item variable.
Thanks in Advance!

Re: How to execute multiple iteration

Posted: Tue Oct 06, 2015 12:05 pm
by upendra
The test data file for above question is as mentioned below.

TESTSUPP TESTLOC TESTITEM TESTPOQTY
1199100 50 10060254 50
Empty Empty 10116850 60
1038100 5 10010769 70



for the second row the Supp and loc is empty.
First Iteration: Supp: 1199100 , loc 50 , items 10060254 and 10116850 and PO qty us 50 and 60
Second iteration: Supp: 1038100, loc 5 , items 10010769 PO qty 60

Re: How to execute multiple iteration

Posted: Thu Oct 08, 2015 10:00 am
by Support Team
Hi upendra,

Order to achieve this scenario, you could separate your test data in two different excel files and execute your modules within a nested test case, but then you would also have to define the data range in the first excel file and update it for the nested test case

For example
File1:
TestSupp loc DataRange
1199100 50 1,2
1038100 5 3

File2:
TestItem TestPOQTY
10060254 50
10116850 60
10010769 70

Please find attached a short sample Solution which illustrates this scenario in more detail.
Please also note that I used Simple Data Connectors instead of Excel files, but it should be no problem to exchange those data connectors.
NestedApproach.zip
A second approach would be to arrange your Excel file as followed

TestSupp loc TestItem TestPOQTY
1199100 50 10060254 50
1199100 50 10116850 60
1038100 5 10010769 70

This approach does not need a nested Test Case, but you need to insert the same TestSupp in multiple lines.

Regards,

Markus (S)

Re: How to execute multiple iteration

Posted: Fri Oct 16, 2015 6:10 am
by upendra
Hi Mark,
Thanks for your reply.As i am new to the ranorex and i am doing record and play back ,could you please tell me where to define the variable data range ,because i have define the data range in first module(supp) below Supp variable and when i am running the script all the values are not picking.

i have defined supp and loc in the first module and then defined items and qty in the second module.

The iteration will be like as below.
1.It will first pick the supp(first supp) and then loc and then pick two items . These two items used in the first supp can't be used for the second supplier. for first two items 10060254 ,10116850 supp will be 1199100 and loc 50.
2.It will first pick the supp(second Supp) and then loc and then pick one item.For this item 10010769 , supplier will be 1038100 and loc will be 5

Note: if user enters supp twice in the excel it will execute three iteration( two for first supp and one for second supp) at the end and for each iteration it will pick only one items.
My query is how to pick multiple items for each supplier
Thanks in Advance!.

Regards
Upendra

Re: How to execute multiple iteration

Posted: Mon Oct 19, 2015 2:18 pm
by Support Team
Hi Upendra,

You just need to copy the SetRange Code Module into your Supp TestCase and adapt the Data Binding as shown below
Nested_Structure.png
Nested_Binding.png
Please also note to adapt the TestCase name inside the setRange Module
Nested_Module.png
Hope that helps.

Regards,
Markus (S)

Re: How to execute multiple iteration

Posted: Fri Aug 04, 2017 3:10 am
by mayur006
Hi Markus,

I have a similar scenario where I have to execute multiple iteration

where my parent test case have csv connector with 3 rows

Attr_Name Cntrl_type
1) abc Radio
2) xyz List
3) pqr Combo

and child test case has csv connector with 5 rows.

Value1 Value2 Value3 BoxType
1) 1 2 3 radbx
2) 4 5 6 radbx
3) 7 8 9 radbx
4) am pm cm lstbx
5) RON CON JON cmbbx

I want to execute the test in a such way that for the first parent row it should execute only first 3 or (number of rows of my choice) rows of child csv connector.

As suggested in earlier post ,I have added the SetRange code module however, I am not sure where and how should I incorporate variable Var_data_range(sup_And_Loc) in my recording.

I am currently using Ranorex 7.1.0.


Thanks
Mayur

Re: How to execute multiple iteration

Posted: Fri Aug 04, 2017 7:49 am
by odklizec
Hi Mayur,

With Ranorex 7.1, you can achieve what you want with conditionally running testcases/smartfolders. In other words, you don't have to use code at all.

Simply create your test structure like this:
TestCase (parent data connector with 3 rows)
|_SmartFolder_1 (child data connector with range set to 1-3 and IF condition connected to parent TC - row 1)
|_SmartFolder_2 (child data connector with range set to 4 and IF condition connected to parent TC - row 2)
|_SmartFolder_3 (child data connector with range set to 5 and IF condition connected to parent TC - row 3)
Now when the parent test case reach 1 row, SmartFolder1 is started, with row 2, SmartFolder2 is started and so long. Hope this helps? ;)

Re: How to execute multiple iteration

Posted: Mon Aug 07, 2017 1:34 am
by mayur006
Thanks odklizec,

I doubt above solution solves my purpose. What I want to achieve here is to use same recording (with variables) for child data connector, if I use three smart folders there is no point in using same recording again and again for each smart folder.

I will try to simplify my scenario again.

Test Case
|_ recording - Open some window.

|_Parent smart folder (Parent csv Data Connector with 3 rows- having 2 variables)
|__recording1(2 variables)........here use values from row1 and go to child smart folder.

|__Child smart folder (Child csv Data Connector with 5 rows- having 4 variables)
|__recording2(4 variables).......here I want to use only specific rows out of 5 for each parent row .

|__recording3..........Exist and go to parent smart folder and select values from data row2.


Parent CSV with 3 rows
Attr_Name Cntrl_type
1) abc Radio
2) xyz List
3) pqr Combo

child csv connector with 5 rows.

Value1 Value2 Value3 BoxType
1) 1 2 3 radbx
2) 4 5 6 radbx
3) 7 8 9 radbx
4) am pm cm lstbx
5) RON CON JON cmbbx

In short, I want to use only one child csv connector by selecting different rows of it, for each iteration of parent data connector.

I hope this will help.

Thanks Mayur

Re: How to execute multiple iteration

Posted: Mon Aug 07, 2017 7:13 am
by odklizec
Hi,

I'm afraid, I still don't see what's wrong with my solution? ;) With my 3 (child) smartfolders, you can use the same data connector (and recording) for each of them. The only difference will be different data range set for each smartfolder (based of the actual parent data connector value)? All you need to do is to setup a condition (for each child smartfolder), which will start or ignore the smartfolder, based of actual row from parent data connector.

Re: How to execute multiple iteration

Posted: Wed Aug 09, 2017 1:57 am
by mayur006
Thanks odklizec :D

I was earlier under impression that for every smartfolder I need to use the different data connector :lol: and thus wasn't sure about solution.

However, It does worked really great. Thanks again :!:

Re: How to execute multiple iteration

Posted: Wed Aug 09, 2017 8:31 am
by odklizec
You are welcome. I'm glad I could help ;)