How to do interrupt based programming : General Questions

How to do interrupt based programming

Ask general questions here.

How to do interrupt based programming

Postby arishahsan » Fri Jan 19, 2007 4: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.
arishahsan
 
Posts: 26
Joined: Thu Jan 18, 2007 1:04 pm

Postby admin » Sat Jan 20, 2007 2: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.

See http://www.ranorex.com/ranorexpro/

Code: Select all
try
{
    Application.ErrorAsException = true;

    form = Application.FindFormTitle("RanorexTestedApp");

    Button button1 = form.FindButton("button1");
    Mouse.ClickControl(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
admin
Site Admin
 
Posts: 351
Joined: Wed Jul 05, 2006 8:44 pm

Re: How to do interrupt based programming

Postby omayer » Fri Oct 28, 2011 9:34 pm

can't make this code to work - getting this error message - Newline in constant (CS1010) - Console.WriteLine("EXCEPTION
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: How to do interrupt based programming

Postby Ciege » Fri Oct 28, 2011 10: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!

Ciege...
User avatar
Ciege
 
Posts: 965
Joined: Thu Oct 16, 2008 7:46 pm
Location: Arizona, USA


Return to General Questions

Who is online

Users browsing this forum: No registered users and 0 guests