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.
How to do interrupt based programming
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/
Jenö Herget
Ranorex Team
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
Re: How to do interrupt based programming
can't make this code to work - getting this error message - Newline in constant (CS1010) - Console.WriteLine("EXCEPTION
Tipu
Re: How to do interrupt based programming
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...
Ciege...