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 |