Forum Discussion

hoodch's avatar
hoodch
New Contributor
10 years ago

GDI Object Leak

I have recently download TestComplete and have started trialling the software. I've create an application in C# designed to test a java app. The test goes well initially, but I have ran into a GDI object leak issue.

 

GDI Object Count Issue

Below is some sample code of how I'm using the APIs provided by TestComplete.

 

using AutomatedQA.TestComplete;
using AutomatedQA.script;

private void SelectFull() { int SleepTime = 500; int Retries = 300; for (int i = 0; i < Retries; i++) { var ExistsCheck = Connect.Sys["Process"]("java")["SwingObject"]("PrintDialog", "Print Dialog", -1, 1)["SwingObject"]("JRootPane", "", 0)["SwingObject"]("null.layeredPane") ["SwingObject"]("null.contentPane")["SwingObject"]("JPanel", "", 0)["SwingObject"]("JPanel", "Field List", 0) ["SwingObject"]("JPanel", "Document Format", 0)["SwingObject"]("JRadioButton", "Full", 1)["Exists"]; if (ExistsCheck) break; else System.Threading.Thread.Sleep(SleepTime); } var FullRadioButton = Connect.Sys["Process"]("java")["SwingObject"]("PrintDialog", "Print Dialog", -1, 1)["SwingObject"]("JRootPane", "", 0)["SwingObject"]("null.layeredPane") ["SwingObject"]("null.contentPane")["SwingObject"]("JPanel", "", 0)["SwingObject"]("JPanel", "Field List", 0) ["SwingObject"]("JPanel", "Document Format", 0)["SwingObject"]("JRadioButton", "Full", 1); FullRadioButton["Click"](); }

 

Currently my stress tests fail after a short period of time. Is there something I'm doing wrong that causes the GDI leak?

 

I would like to get this sorted before committing to purchasing the software.

 

Edit: Also if you just close TestComplete test and try to restart it, it can no longer detect the java app.  The only solution is to close the java app and TestComplete down. This means the test I'm doing can never be completed as it currently stands.

3 Replies

    • hoodch's avatar
      hoodch
      New Contributor

      Apologies for the delay, I will get a solution up together that repeats the issue so you can take a look.

      • hoodch's avatar
        hoodch
        New Contributor

        I have created a sample application that re-creates the GDI error, see attached.  I've used a online java applet to demostrate the issue.  Please check the GDI count and you notice it does not go down only up.  There also appears to be an issue running the test again after you have finished, testcomplete does not appear to be to fine the application a second time with out restarting both the test application and the java applet.

         

        I've also uploaded the same project to my case via the link provided by "Vladimir Lapidus".