Working with Uneven Data Sets
Posted: Fri Mar 11, 2016 2:04 am
What is the Best way to Setup your Test Suite and Test Data To Execute an Uneven Data Set?
I do not want to create a Recording for Each Item in My application When I can Data Drive the Repo_Item and perform the Actions I need to, but My issue is that My Data Set Is Uneven Since I have Tree Views and I want to be able to control with the Data Sheet what Items get Tested, thus I did think about using: UserCodeMethod_1 (See below) that dynamically clicks all my trees, but this is not viable since I need to only run certain cases at times.
What I would like to be able to do is Using My Data Set Iterate Tree_Main : Tree_Main_1 with Tree_Item_1: Rule_1 with Tree_Item and the Iterate Rule_A_1 to Rule_A7 then Goto Tree_Item_1: Rule_2 and Iterate either an New Tree_Item Set or Tree Items again?
Is this possible with Using something like:
IList<TestCase> testcases = TestSuite.Current.SelectedRunConfig.GetActiveTestCases();
//Then resetting the Test Case range? Some Examples would be helpful.
TestCase.Current.DataContext.SetRange(min, max);
My Data Set
Tree_Main----------Tree_Item_1------------------Tree_Item
Tree_Main_1-------Rule_1--------------------------Rule_A_1
Tree_Main_2-------Rule_2--------------------------Rule_A_2
Tree_Main_3-------Rule_3--------------------------Rule_A_3
Tree_Main_4-----------------------------------------Rule_A_4
Tree_Main_5-----------------------------------------Rule_A_5
Tree_Main_6-----------------------------------------Rule_A_6
---------------------------------------------------------Rule_A_7
I do not want to create a Recording for Each Item in My application When I can Data Drive the Repo_Item and perform the Actions I need to, but My issue is that My Data Set Is Uneven Since I have Tree Views and I want to be able to control with the Data Sheet what Items get Tested, thus I did think about using: UserCodeMethod_1 (See below) that dynamically clicks all my trees, but this is not viable since I need to only run certain cases at times.
What I would like to be able to do is Using My Data Set Iterate Tree_Main : Tree_Main_1 with Tree_Item_1: Rule_1 with Tree_Item and the Iterate Rule_A_1 to Rule_A7 then Goto Tree_Item_1: Rule_2 and Iterate either an New Tree_Item Set or Tree Items again?
Is this possible with Using something like:
IList<TestCase> testcases = TestSuite.Current.SelectedRunConfig.GetActiveTestCases();
//Then resetting the Test Case range? Some Examples would be helpful.
TestCase.Current.DataContext.SetRange(min, max);
My Data Set
Tree_Main----------Tree_Item_1------------------Tree_Item
Tree_Main_1-------Rule_1--------------------------Rule_A_1
Tree_Main_2-------Rule_2--------------------------Rule_A_2
Tree_Main_3-------Rule_3--------------------------Rule_A_3
Tree_Main_4-----------------------------------------Rule_A_4
Tree_Main_5-----------------------------------------Rule_A_5
Tree_Main_6-----------------------------------------Rule_A_6
---------------------------------------------------------Rule_A_7
Code: Select all
public void UserCodeMethod_1()
{
IList<Ranorex.TreeItem> firstChildren = repo.Form1.TreeView2.ChildrenofMainNodeInfo.CreateAdapters<Ranorex.TreeItem>();
foreach( Ranorex.TreeItem ti in firstChildren)
{
ti.DoubleClick();
IList<Ranorex.TreeItem> grandchildren = ti.Find<Ranorex.TreeItem>("./treeitem");
foreach(Ranorex.TreeItem gti in grandchildren)
{
if (gti.Children.Count>0)
{
gti.DoubleClick();
IList<Ranorex.TreeItem> grandchildren2 = gti.Find<Ranorex.TreeItem>("./treeitem");
foreach(Ranorex.TreeItem gti2 in grandchildren2)
{
gti2.DoubleClick();
Delay.Seconds(1);
}
}
else
{
gti.DoubleClick();
Delay.Seconds(1);
}
}
}
}