Forum Discussion

duncanbrown's avatar
duncanbrown
Occasional Contributor
14 years ago

OnStopTest and exceptions

Hi,



I'm using TestComplete 7 and am trying to put something in place that will send an email notification whenever a test finishes. To do this, I've set up a handler for the OnStopTest event and this works fine in most cases - specifically, it works fine if the test run finishes without any problems, or if execution is terminated due to an error being logged. However, where it falls down is when execution stops due to an exception. In this case, the code in the handler gets executed only after I've closed the exception dialog that TestComplete shows, which rather defeats the point of the automatic emails...if there's no-one around, the dialog will stay on the screen and no email will get sent.



Is there any way around this? Some option that will have TestComplete automatically close the dialog, for example? I know that in many cases the solution would just be to handle the errors in the code, but this won't work for me here due to the problems TestComplete has with handling exceptions across different script units.



Thanks,

Duncan
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    First, a question:



    Are you running your project using the commandline of TestComplete or TestExecute?  If so, you can turn on a "/silentmode" commandline switch which will automatically close any dialogues that your automation project encounters.



    In either case, though, you can adjust how a project runs in playback for errors.  In your Project Properties, there's an option for Playback.  In there, there's a checkbox for "Error dialog".  If that is turned off, when an error occurs, TC will no longer display the dialog but will simply log the error to the TestLog and proceed accordingly.
  • duncanbrown's avatar
    duncanbrown
    Occasional Contributor
    Hi,



    No, I'm not running from the command line. The 'Error dialog' option was just what I was looking for, though. I had thought that it just stopped the 'do you want other tests to continue' dialog, but in fact it stops the exception dialog too, which is just what I need.

     

    Thanks very much for your help.