Forum Discussion

zdanov's avatar
zdanov
Contributor
13 years ago

Handling Unexpected Exceptions

Hi,

I would very much appreciate some information how to handle unexpected exceptions during script playback. To be more specific, our applicaiton is windows based app. Test goes through various screens, checks various tabs, controls, calculations, buttons,etc. Sometimes an unexpected exception is produced (which is an error), that will cause the test to fail. How does Test Complete handle this type of situation? Can it capture the exception detials, mark the script as failed, and contine on with the next set of scripts? How does it close all left over open windows (clean up) that remain as a result of this exception, since the script could not close all windows as recorded due to this exception being thrown?



I am attaching a snapshot of one such exception; hope it helps!



Thank you very much!



Regards,

Serge.
  • Hi David,

    Thank you for this information; I will look at the link provided. Last week I have uploaded a sample application of our grid control to the ftp

    link provided by one of your team members. I'm not sure if it was uploaded correctly or not. This sample app contains the exact same grid that I'm having problems with, which is the grid control predominantly used in our application. The app is coded in C#, and it is the combinatio of WinForms, Infragistics, and our custom controls. I also submitted a new ticket for this issue, so I'm waiting to hear back about that also.



    Thanks!

    Serge.
  • pdhuwalia's avatar
    pdhuwalia
    New Contributor
    Hi Srdjan,



    Its funny I came across this post when I looking for a solution to event handling and I found your question about the grid controls. I struggled with the same situation for while before I tried the options below.



    A bit of info before hand , I am new to Test Complete and currently working on a Windows based .NET application. Most part of my application uses similar data and a number of panels are grids. If you haven't found a solution already, please try this and let me know if it works.



    Go to Tools Menu -> default project properties / current project properties -> Object Mapping -> Microsoft Controls (since the grids I am working on are System.Windows.Forms.DataGrid) -> check the derived classes check box -> and additionally Click on 'Add From Screen' button and map the grid of your application using the object finder -> again check the derived classes check box for the new object map. Save on close



    Record an action on the grid after changing the settings and try to derive the child objects or grid properties.








  • Hello Priya,

    Thank you for your input and I apologize for such late reply. We had to put on hold Automation evaluations due to other project, but now that I'm back on it, I was going through my old issues and I just saw your post. Unfortunately, your method did not work either; the child count still shows 0, even after adding cutom grid class. I guess I will have to leave that part for manual testing...



    Thanks!



    Regards,

    Serge.
  • jean_farah's avatar
    jean_farah
    New Contributor
    Hi all,

    I have a question about the Unexpected window handling. Can I add vbscript code to the OnUnexpectedWindow event to hold the execution of the current sub that generated the exception and jump to the next sub of the same test item?



    In other words, can I control the execution of subs of the same test item from the OnUnexpectedWindow event?



    Regards,

  • Hi Jean,


     


    No, there is no way to do this. You can only stop a separate test item.


     


    Please note that if you are aware that an unexpected window can appear in a moment, it is not unexpected. You can just check existing of this window without using any event handlers and stop the current routine execution.

  • Hi  All/Serge,


    Did you implement  Exception Handling Mechanism in your project? , If "Yes",Could you please share that source code?( Code snippet for Exception Handling and CLean up the tasks/activities,I mean closing all open windows where you got exception at first stage?)



    Kind Regards,

    Kumar.


  • Hi Kumar,

    I have not implemented this routine; my initial question came out of the evaluation process of Test Complete. I am mostly using it for keyword driven testing, since I'm not a programmer and don't write the code. Currently, the only way I was able to deal with exception windows is via "ignore unexpected window" option and by sending the comand to press ESC to close the screen.



    Sorry for not being able to help you out more...



    Regards,

    Serge.
  • Hi Serge,



    Thanks for the reply. I have written code for exception handling,but it's not handling in better way.... going to add better exception handling logic once  i will go through the articles of TC exception handling.



    Kumar