Forum Discussion

fmendes's avatar
fmendes
Contributor
14 years ago

On Error Handling

All, I am handling the GeneralEvents_OnLogError event from script. Inside of the event I would like to do the following:

1) Finish logging the error to file

2) Close the application (to clean up any bad state)

3) Open the application

4) Resume testing from where it was left of

2 Replies

  • Hi Luis,


    To learn how to create event handlers for the OnLogError event, please read http://smartbear.com/support/viewarticle/11454/ in the online documentation.


    Details:


    1) Finish logging the error to file


    To obtain the error's text, you can use the LogParams.Str method.

    If you would like to save the error's text to a file, you can use methods of the aqFile object.





    2) Close the application (to clean up any bad state)


    To close the application, use the TestedApp.Close method.





    3) Open the application


    To launch the application, you can use the TestedApp.Run method.





    4) Resume testing from where it was left of


    In order for TestComplete to continue running the test after the error is handled, the Stop on error option must be disabled.

    Also, please pay attention to the On unexpected window option group. For example, if the Stop execution option is enabled, the test engine may end the test when an error dialog appears.