Data Binding and Different Module Iterations?

Ask general questions here.
Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Data Binding and Different Module Iterations?

Post by Fergal » Tue May 03, 2016 9:37 am

Example Data Source

Address
Add1
Add2
Add3
Add4
Add5

Test Suite
TC1 -
Module 1
Module 2

The Data Source has 5 rows, Add1 - Add5. Is it possible to set up the test suite, so that when TC1 is run:

Module 1 is run with two iterations using Add1 and Add2 and
Module 2 is run with two iterations using Add3 and Add4?

How can this be done?

Thanks!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3938
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Data Binding and Different Module Iterations?

Post by odklizec » Tue May 03, 2016 11:23 am

Hi Fergal,

In my opinion, the easiest way to achieve what you want is to put Module1 and Module2 into separate Test Cases, then enable or disable these test cases based of the actual data connector iteration.

So basically, the structure of your test should look like this:
TC1
|_TC_Module_1
|_Module 1
|_TC_Module_2
|_Module 2

Now create a new code module and place it to setup section of TC1. Then use this code to enable/disable module1/2 based of the actual TC1 iteration:

Code: Select all

	int tcIteration = TestSuite.Current.GetTestCase("TC1").DataContext.CurrentRowIndex;
	if (tcIteration == 1 | tcIteration == 2)
	{
		TestSuite.Current.GetTestCase("TC_Module_1").Checked = true;
		TestSuite.Current.GetTestCase("TC_Module_2").Checked = false;
	}
	else if (tcIteration == 3 | tcIteration == 4)
	{
		TestSuite.Current.GetTestCase("TC_Module_1").Checked = false;
		TestSuite.Current.GetTestCase("TC_Module_2").Checked = true;
	}
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Data Binding and Different Module Iterations?

Post by Fergal » Thu May 05, 2016 1:06 pm

Thanks for your reply and helpful suggestion odklizec. I do like the idea of moving the modules into child TCs and will work on that next time I face this issue.

Thanks again!