Hi ,
How can i access the parent folder name of the test case being executed ?
since our test cases are organized by categories in the rxtst file ,
and have corresponding config files organized in the same manner,
would like avoid parsing through multiple directories to get to the correct file
Did not see a parameter in TestSuite.current for this value ?
[folder] Category 1
TestCase 1
TestCase 2
TestCase 3
....
[folder] Category 2
TestCase 1
TestCase 2
TestCase 3
....
[folder] Category 3
TestCase 1
TestCase 2
TestCase 3
....
please advice
Regards,
Prad
Access Folder Name in the rxtst file
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Access Folder Name in the rxtst file
Hi,
You can use this code to get the parent folder name, or you can use the second one to print/get the whole test suite structure:
Input this code in one of your files of the actual test case.
first:
second:
Regards,
Markus
Ranorex Support Team
You can use this code to get the parent folder name, or you can use the second one to print/get the whole test suite structure:
Input this code in one of your files of the actual test case.
first:
var TC = (TestCase)TestCase.Current; if (TC.Parent.GetType() == typeof (TestSuiteFolder) ) { var parTC = TC.Parent; Report.Info (TC.Parent.DisplayName); }Just input the code into a UserCode file of your solution.
second:
void ITestModule.Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; TestSuite TS = (TestSuite)TestSuite.Current; PrintChildren(TS.TestSuiteEntry, 0); } void PrintChildren(TestSuiteEntry entry, int depth) { String whitespaces = ""; for(int i=0;i<depth;i++) whitespaces += "--"; foreach(TestSuiteEntry child in entry.Children) { Report.Info(whitespaces + child.DisplayName); PrintChildren(child, depth + 1); } }I have also attached the created UserCode file.
Regards,
Markus
Ranorex Support Team
You do not have the required permissions to view the files attached to this post.