Class library usage, coding and language questions.
-
vatsal
- Posts: 1
- Joined: Tue Jul 01, 2014 6:23 am
Post
by vatsal » Tue Jul 01, 2014 6:29 am
We are trying to enable/disable testcases in a test suite dynamically just before starting the execution. Planning to use
Code: Select all
TestSuite.Current.GetTestCase("TESTCASE_NAME").Checked= true/false
What is the best way to get the list of testcases from the test suite using ranorex APIs so that we can iterate through it to enable/disable the test cases.
-
Support Team
- Site Admin

- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Post
by Support Team » Wed Jul 02, 2014 4:47 pm
Hi,
Would the following forum thread be of help for you:
Starting Testcase by condition?
Do you know that you can also specify different so called
Run Configurations?
This allows you to specify and then select different testcase configurations. You can also select a specific testcase configuration by using the command line argument described here
Running Tests without Ranorex Studio:
runconfig|rc:<configuration name>
Runs the test cases of the specified configuration defined by the rxtst file. Configurations can be edited using Ranorex Studio or TestSuiteRunner. By default, the currently selected run config is used.
Please let me know when you need further assistance!
Regards,
Markus
.

-
BorisS
- Posts: 14
- Joined: Fri Jul 11, 2014 2:25 pm
Post
by BorisS » Tue Sep 09, 2014 9:11 am
TestCases hold only guid strings not the class themselves. To get the active test cases I used the following code
Code: Select all
List<string> tcases = new List<string>(); //all testcases in this testsuite
int i = 0;
var rconf = TestSuite.Current.SelectedRunConfig.GetActiveTestCases();
for (i =0; i< rconf.Count; i++)
tcases.Add(cname);
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
foreach (Type tp in types)
{
if( tcases.Contains(tp.Name) )
{
//'tp' it is a test case
}
}