Hi,
I have a TC in this format:
TC
- Recording Module A
- Recording Module B
- Recording Module C
- Recording Module D
I'd like to insert a code module between Recording Module A and Recording Module B, that will end and pass the TC, if a certain element exists. What code can I use to break out of the TC and not run the subsequent recording modules.
Edit: Using Ranorex 6.2.1 on Windows 7
Thanks
Code to break out of a Test Case
-
- Certified Professional
- Posts: 349
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Code to break out of a Test Case
Last edited by Fergal on Wed Sep 06, 2017 11:23 am, edited 1 time in total.
Re: Code to break out of a Test Case
Hi,
I think the cleanest solution of your problem is enclosing modules B, C and D in a nested smart folder. Then you should setup a condition, which will run or ignore the smart folder, based of the variable/parameter filled via the code module you mentioned (placed before the smart folder with condition). I believe there is also a coded way to achieve what you want? But if I remember it correctly, it uses an internal API, which is not recommended to use
So using nested SF with condition is probably the best way.
I think the cleanest solution of your problem is enclosing modules B, C and D in a nested smart folder. Then you should setup a condition, which will run or ignore the smart folder, based of the variable/parameter filled via the code module you mentioned (placed before the smart folder with condition). I believe there is also a coded way to achieve what you want? But if I remember it correctly, it uses an internal API, which is not recommended to use

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 349
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Code to break out of a Test Case
Thanks for your suggestion and reply odklizec. Sorry but I should have said I am using Ranorex 6.2.1, so I don't think that's an option on this version.
Re: Code to break out of a Test Case
Well, in this case, you still have two options...
You can still create a nested test case (placed after code module), and then disable/enable it from code, like this:
And this sample skips all TestCase modules (uses internal API):
https://www.ranorex.com/forum/how-to-st ... tml#p24582
Hope this helps?
You can still create a nested test case (placed after code module), and then disable/enable it from code, like this:
Code: Select all
TestSuite.Current.GetTestCase("TestCaseName").Checked = false;
https://www.ranorex.com/forum/how-to-st ... tml#p24582
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 349
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Code to break out of a Test Case
Thanks very much Pavel. Your first option looks perfect, will work on that and reply back if I have any issues / questions.