How to report failure and exit test.

Ask general questions here.
rastek
Posts: 185
Joined: Wed Aug 06, 2014 12:00 pm

How to report failure and exit test.

Post by rastek » Wed Sep 03, 2014 7:59 am

Hi

I need to exact code to report failure and exit test.

I searched the forum but can not find, please help.

Thanks,
rastek.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to report failure and exit test.

Post by Support Team » Thu Sep 04, 2014 1:14 pm

Hi Rastek,

You can easily create a failure message within the report with
Report.Failure("Fail", "The test failed");
Unfortunately, the Report.Failure() method does not abort the current test run.

But you can use the following workaround, in order to exit the test run:
Validate.IsFalse(true,"Force to fail");
this will cause an exception and the test will abort with the message "Force to fail".

Regards,
Markus (S)