Forum Discussion

pvidal's avatar
pvidal
Contributor
14 years ago

TestComplete triggers exceptions in the tested application.

Hello,



Since the beginning of our automation effort on few occasions TestComplete would hang and our application would throw a system exception when TestComplete called WaitWinFormsObject. Because it only happened few times we chose to ignore it and we just re-started the test (these are several hour-long tests).



We have kept adding test cases to our projects and now we have the situation where for some of our tests TestComplete will always hang and our application would throw a system exception (I don't know what happens first).



So far we these exceptions (always the same on a specific test case):

  1. System.Runtime.InteropServices.SEHException at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(...)

  2. System.Runtime.InteropServices.SEHException at CWinThread.PreTranslateMessage(...)


The exceptions are only thrown when TestComplete is driving our application. They never happen when manually driving our application.



TestComplete hangs and it only responds when we kill our application process.



We are really stuck on this and I have no clue what to do. I was able to prevent one of the crashes by avoiding the call to WaitWinFormsObject and just doing a delay and a blind click using Sys.Desktop.MouseDown and Sys.Desktop.MouseUp. But I can't use this work around when I need the Window object.



The weird thing is that for the test case with the work around the test case continues executing and can call WaitWinFormsObject on other windows.



Thank you for your help. Regards,

Patricio.

6 Replies



  • Hi Patricio,






    Please answer the following questions:






    1. What TestComplete version are you using?


    If it is earlier than TC 7.52, upgrade to version 7.52 and check whether the problem persists.






    2. Was .NET Framework 4 installed on this PC? If it was, most probably, you face a known issue for which we have a patch. See this article for more information.






    If the problem still persists with TC 7.52, we need you to collect some additional information. Please follow the steps below:






    1. Download a free trial version of AQtime 6, which is our profiling tool, from our web site. The trial can be requested here.


    2. Install the tool.


    3. Start AQtime with the -NotOpenApp command line argument. For example, you can use the following command line:


    "c:\Program Files\Automated QA\AQtime 6\Bin\AQtime.exe" -NotOpenApp


    4. Select the 'File | New Project From Module...' main menu item.


    5. In the Open File dialog, select the executable file of the tested application and click Open.


    6. Take a look at the AQtime toolbar - there is a combo box. Open it and select the "Tracing | Exception Trace Profiler" item.


    7. Select the "Options | Options..." main menu command - the Options dialog will appear.


    8. Set the "Profiling Time | Event View | General | Exceptions | Depth shown" setting to 100 and click OK.


    9. Click the Run toolbar button (the green arrow) or press F5 to start the profiling.


    10. AQtime will start the tested application and trace all exceptions that will occur in the application until it is closed.


    11. Reproduce the problem.


    12. After the problem occurs, right-click somewhere within the Event View panel (it is opened by default at the bottom of AQtime's window) and select the 'Save All...' item.


    13. Save the panel's contents to an HTML file and send the file via our Contact Support form.





    Also, please generate a memory dump for TestComplete when it hangs. To generate it, please follow the steps below:


    1. Repeat steps 3 and 4.


    2. In the Open File dialog, select the TestComplete.exe file and click Open.


    3. Click the Run toolbar button (the green arrow) or press F5 to start the profiling.


    4. Once TestComplete hangs, wait for five minutes and generate a dump by clicking the "Generate Process Dump" button on the Event View panel's toolbar - the panel is at the bottom of AQtime's window and the toolbar is at the top of the panel.






    If you don't see the button (it may be hidden by default):


      - right-click the toolbar;


      - select Customize;


      - switch to the Commands tab;


      - select the Event View category;


      - drag the "Generate Process Dump" command from the Commands list and drop it to the Event View panel's toolbar.






    5. Save the Event View panel's contents to an HTML file.






    6. Send the generated dump file along with the Event View contents via our Contact Support form.






    Thanks in advance.
  • Hello Alex,



    1. We are using TC 7.52.



    2. No, the .NET Framework 4 is not installed in any of the machines (all the machines, including VMs, have the same problem).



    I will follow the procedure to generate the dumps.



    Thank you,

    Patricio.



  • Hi Patricio,





    Thanks for the information. We are waiting for the files. In the meantime, please try increasing the value of the 'Method invoke timeout' option which is located in the "Open Applications | General" section of the project properties page. Let me know whether this helps.
  • Hello Alex,



    The developers did some changes in the threading-UI code of the application and now the tests are executing with no exceptions or hangs. I will keep an eye on the issue and will capture the dumps if the problem comes back.



    Thank you,

    Patricio.
  • JonoW's avatar
    JonoW
    Occasional Contributor
    Hi Patricio,



    I don't know if you'll ever read this, but is there anything you can tell me about what changes were necessary to the UI threading, anything in particular to avoid etc?



    We seem to be having our application crashing when certain elements of the UI are accessed by TC, when I'm trying to do name mapping operations. Even just expanding the relevant nodes in the Object Explorer tree crashes the app.
  • Hello Jono,



    I don't have the details because it was a remote team. What I was told is that they had some bussiness logic in the UI code and that the threads were interfering with each other. I never understood why it will fail only with TC and never with user interaction. They separated the bussiness logic from the UI and the problem went away.



    Regards,

    Patricio.