i want to set the range of a testcase in a user code module. In DataSource GUI dialog you can enter something like "1-3,5-8,10". In user code i have tried some functions mentioned in this posting "setting-datasource-range-from-and-to-parameters-from-code"
The problem is that i can only set a continuous range with the following code:
Code: Select all
TestSuite.Current.GetTestCase("TestCase").DataContext.SetRange(1,3)
Code: Select all
TestSuite.Current.GetTestCase("TestCase").DataContext.SetRange(DataRange.Parse("1-2,4-5"))
Update: Writing this posting i found the "DataRangeSet" class that can parse multiple ranges. So my Problem is solved

To set multiple ranges use code like this:
Code: Select all
TestSuite.Current.GetTestCase("TestCase").DataContext.SetRange(DataRangeSet.Parse("1-3,4-5,6,7-10"))
Code: Select all
report.Log(reportlevel.Info,TestSuite.Current.GetTestCase("TestCase").DataRange.ToString)
TestSuite.Current.GetTestCase("TestCase").DataContext.SetRange(DataRangeSet.Parse("1-3,4-5,6,7-10"))
report.Log(reportlevel.Info,TestSuite.Current.GetTestCase("TestCase").DataRange.ToString)