How to do interrupt based programming

Ask general questions here.
Posts: 26
Joined: Thu Jan 18, 2007 12:04 pm

How to do interrupt based programming

Post by arishahsan » Fri Jan 19, 2007 3:25 pm

How will we implement interrupt based programming using ranorex so that as soon as an error message appears the test case terminate from that
point without executing the rest of the test case.

Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sat Jan 20, 2007 1:28 am

The easiest way is to use C# and Exception Handling.
If you set the Application.ErrorAsException property, then Ranorex throws a RanorexException every time an operation failed.
You can catch this exception and exit your test case with an error code.


Code: Select all

    Application.ErrorAsException = true;
    form = Application.FindFormTitle("RanorexTestedApp");
    Button button1 = form.FindButton("button1");
    Console.WriteLine("TEST PASSED");
    return 0;
catch (RanorexException e)
    Console.WriteLine("EXCEPTION Source={0} Sender={1} Message={2}
              StackTrace={3}", e.Source, e.Control, e.Message, e.StackTrace);
    Console.WriteLine("TEST FAILED");
    return 1;

Jenö Herget
Ranorex Team

Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: How to do interrupt based programming

Post by omayer » Fri Oct 28, 2011 8:34 pm

can't make this code to work - getting this error message - Newline in constant (CS1010) - Console.WriteLine("EXCEPTION

User avatar
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: How to do interrupt based programming

Post by Ciege » Fri Oct 28, 2011 9:53 pm

You could also start a second thread that checks for error messages or exceptions thrown by your AUT. When one occurs the second thread can tell the main Ranorex thread to abort.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!