Hi,
I would like to now if it is possible to abort a module using a specific piece of code, but to continue on the next module within the same test case?
I read this page:
http://www.ranorex.com/support/user-gui ... html#c3028
But it doesn't satisfy my need.
Abort module but continue within the same test case
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Abort module but continue within the same test case
Hi,
How do you abort the module, do you throw an exception?
If so you could catch the exception Report that an error/failure occurred (Report.Failure(...)) and continue with the next module.
Regards,
Markus
How do you abort the module, do you throw an exception?
If so you could catch the exception Report that an error/failure occurred (Report.Failure(...)) and continue with the next module.
Regards,
Markus
Re: Abort module but continue within the same test case
Hi,
I tried:
But it completely stops the test case.
I tried to put a Report.Failure("myMessage"); but the test case continue within the same module. How can I do ? Do I have to use a try/catch code? For example:
I tried:
Code: Select all
throw new RanorexException();
I tried to put a Report.Failure("myMessage"); but the test case continue within the same module. How can I do ? Do I have to use a try/catch code? For example:
Code: Select all
try {
action1();
action2();
if (event1=true) {
report.failure("mymessage");
}
catch (exception e) {
}
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Abort module but continue within the same test case
Hi,
here is a sample code implementing Markus' description:
Regards,
Tobias
Ranorex Team
here is a sample code implementing Markus' description:
try{ action1(); action2(); if (event1==true) throw new RanorexException ("Your Exception Text"); action3(); action4(); } catch (Exception e) { Report.Failure(e.ToString()); }action1 and action2 will be executed and if event1 is true an exception will be thrown which will be caught with reporting a failure. Doing so, action3 and action4 will not be executed, and the execution will continue with next module (if the error behavior is set to "Continue with sibling").
Regards,
Tobias
Ranorex Team
Re: Abort module but continue within the same test case
Thank you very much for your help.
I will try this ASAP
I will try this ASAP
Re: Abort module but continue within the same test case
Yeah OK, I understood!
I have to put all the code module inside the "try /catch". The RanorexException stops the try/catch but continue to the following lines after the catch, and to the next module.
Thank you very much!
I have to put all the code module inside the "try /catch". The RanorexException stops the try/catch but continue to the following lines after the catch, and to the next module.
Thank you very much!