Set multiple range in user code module
Posted: Wed Sep 17, 2014 12:49 pm
hi,
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:
If i try this code
the following error is shown: "The specified range string contains more then one range." (Typo: than)
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:
Is it correct that DataRange of the TestCase is not updated immediatly? The following code only shows the DataRange configured in the GUI:
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)