I have error handling in my test runners as:
catch (ImageNotFoundException e)
{
Report.Error(e.ToString());
Report.LogData(ReportLevel.Error, "Image not found", e.Feature);
Report.LogData(ReportLevel.Error, "Searched image", e.Image);
error = -1;
}
catch (RanorexException e)
{
Report.Error(e.ToString());
Report.Screenshot();
error = -1;
}
catch (ThreadAbortException)
{
Report.Warn("AbortKey has been pressed");
Thread.ResetAbort();
error = 1;
}
catch (Exception e)
{
Report.Error("Unexpected exception occured: " + e.ToString());
error = -1;
}
Then I pass the error code to Program.cs where I display some custom dialog boxes depending on the error code:
//Display Error Dialog if an Error Occurs or Success Dialog if Test Completes Without Errors
if (error == -1)
{
CommonUtilLib.Util.MsgBox.Show("An Error Has Occurred, Test Aborted.","Test Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (error == 0)
{
CommonUtilLib.Util.MsgBox.Show("Test Successfully Executed","Test Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (error == 1)
{
CommonUtilLib.Util.MsgBox.Show("You Have Aborted the Test","Test Aborted", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
This works fine when I run my projects executable with 1 argument. But if I string multiple arguments together and then Ranorex errors on one test, the executable will remain running and begin executing the next test. Is there anyway to kill the exe when an error occurs during playback, instead just logging the error and continuing to the next test? Thanks
Killing Executable With Muliple Arguments
-
- Posts: 94
- Joined: Tue Jun 16, 2009 10:27 pm
Re: Killing Executable With Muliple Arguments
How about:
If error < 2 Then End
If error < 2 Then End
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Killing Executable With Muliple Arguments
Well, I guess that you have to change the code that starts the individual recordings/executables and check the return value of the recording/executable. If it's an error, then don't start the next executable/recording.costamesakid wrote:But if I string multiple arguments together and then Ranorex errors on one test, the executable will remain running and begin executing the next test
Don't know how your code looks like that starts the individual recordings, but it should not be too difficult to add a check for the returned error code.
Regards,
Alex
Ranorex Team