Page 1 of 1

Data Binding and Different Module Iterations?

Posted: Tue May 03, 2016 9:37 am
by Fergal
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!

Re: Data Binding and Different Module Iterations?

Posted: Tue May 03, 2016 11:23 am
by odklizec
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?

Re: Data Binding and Different Module Iterations?

Posted: Thu May 05, 2016 1:06 pm
by Fergal
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!