Page 1 of 1

How to fail a test case in code?

Posted: Mon Jul 20, 2015 10:22 am
by mantov
Hi i'm using Ranorex Studio. I have a test solution with a recording and user code file. The recording has a few steps(manual actions).

In my user code i set up a new thread, that periodically checks for any popups. If a popup appears, i want the test case to fail.

How do i fail the test case in code?

I tried :

Code: Select all

Validate.NotExists(repo.ScriptError.SelfInfo);
But that only throws an exception, it doesnt fail the test case.

I have also tried:

Code: Select all

Report.Failure("Validation", "my message");
Report.Log(ReportLevel.Failure, "failure message 2");
With the above code, the report logs these errors but the test case still passes.

Any help would be appreciated.

Re: How to fail a test case in code?

Posted: Mon Jul 20, 2015 12:20 pm
by odklizec
Hi,

If I'm not mistaken, there is still no way to pause/kill the test case (main thread) from popup watcher (second thread). Check for example the "workaround" post mentioned here:
http://www.ranorex.com/forum/popupwatch ... pup#p24914