I'm using Ranorex 7 and try to get all TestCases using:
Code: Select all
TestSuite.Current.SelectedRunConfig.GetActiveTestContainers()
Is there a missing implementation?
Best Regards Christopher
Code: Select all
TestSuite.Current.SelectedRunConfig.GetActiveTestContainers()
private IList<TestCaseNode> GetActiveTestCases() { var suite = (TestSuite)TestSuite.Current; IList<TestCaseNode> sample_list=new List<TestCaseNode>{}; var entries = suite.GetAllTestSuiteEntries(); foreach (var entry in entries) { var tc = entry as TestCaseNode; if (tc != null) { if (tc.Checked && !tc.IsRootTestCase && !tc.IsSmartFolder) { sample_list.Add(tc); } } } return sample_list; }Make sure to check the release notes when the next release comes around and see if it is already fixed so you don't continue using a workaround instead of the intended method.
private IList<TestCaseNode> SelectedRunConfig_GetActiveTestContainers() { var suite = (TestSuite)TestSuite.Current; IList<TestCaseNode> sample_list=new List<TestCaseNode>{}; var entries = suite.SelectedRunConfig.GetActiveTestContainers(); foreach (var entry in entries) { var tc = entry as TestCaseNode; if (tc != null) { if (!tc.IsRootTestCase && tc.IsSmartFolder) { sample_list.Add(tc); } } } return sample_list; }There needs to be a check for the container to actually be a smart folder ("tc.IsSmartFolder").