Ranorex

How to do interrupt based programming

 
Post new topic   Reply to topic    Ranorex Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
arishahsan



Joined: 18 Jan 2007
Posts: 26

PostPosted: Fri Jan 19, 2007 4:25 pm    Post subject: How to do interrupt based programming
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.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sat Jan 20, 2007 2:28 am    Post subject:
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: click into code to enlarge
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, .StackTrace);
    Console.WriteLine("TEST FAILED");
    return 1;
}

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> General Questions All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum