Hi,
I am trying to avoid some modules to run under a test case if the first module failed to run (in my case the application didn't start correctly).
I am using the following code:
Report.Failure(ReportLevel.Failure.ToString(), String.Format("Failed to run application: {0}", appPath));
TestReport.EndTestCase();
But the actions still running after the first one failed to run.
Please help
Ending Test Case Modules
Re: Ending Test Case Modules
Hello
Try the following :
Throwing an exception like the one above aborts the current TestCase and continues with the next one.
Regards
Boris
Try the following :
if (yourcondition){ throw new Ranorex.ValidationException("Failed to start x.exe"); }It seems using Report.Failure returns a failure for the module but keeps going with the next Recording (or Code) Module. (I wonder if it's intended by the way )
Throwing an exception like the one above aborts the current TestCase and continues with the next one.
Regards
Boris
A simple thank you always does wonders !
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ending Test Case Modules
It is intended. Report.Failure allows you to report several test failures from one module, e.g. if you validate a bunch of attributes from an element or the existence of a bunch of elements.Swisside wrote:It seems using Report.Failure returns a failure for the module but keeps going with the next Recording (or Code) Module. (I wonder if it's intended by the way )
Throwing an exception (or just returning from the module Run method) lets you end the specific module.
Regards,
Alex
Ranorex Team
Re: Ending Test Case Modules
Thank you!
Throwing an exception solved the problem.
BTW - regarding the second option, could you please elaborate?
Regards,
--Eli
Throwing an exception solved the problem.
BTW - regarding the second option, could you please elaborate?
Regards,
--Eli
Re: Ending Test Case Modules
Hello
Report.Failure allows you to show a step failed (it has to be a non mandatory step cause it will not stop executing the module) thus enabling a more detailed failure tracking when you read the report.
See the attached screenshot for an example
Regards
Report.Failure allows you to show a step failed (it has to be a non mandatory step cause it will not stop executing the module) thus enabling a more detailed failure tracking when you read the report.
See the attached screenshot for an example
Regards
You do not have the required permissions to view the files attached to this post.
A simple thank you always does wonders !