Working with Uneven Data Sets

Best practices, code snippets for common functionality, examples, and guidelines.
toddsuzuki
Posts: 1
Joined: Tue Feb 09, 2016 8:43 pm

Working with Uneven Data Sets

Post by toddsuzuki » 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





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);
					}
				}
			}

		}

User avatar
RobinHood42
Posts: 238
Joined: Fri Jan 09, 2015 3:24 pm

Re: Working with Uneven Data Sets

Post by RobinHood42 » Tue Mar 15, 2016 10:21 am

Hi toddsuzuki,

I'm not exactly sure what you want to achieve, but I have seen the following post explaining the modification of the data range. setting-datasource-range

Hope this helps,
Robin