Forum Discussion

rvg's avatar
rvg
Occasional Contributor
4 years ago

Slow object recognition working with swing application

Hi everybody,

 

I am working with the automated tests for a swing application. Tests are being developed for rather long time. Usually they are performed with a good speed. But sometimes the objects recognition becomes too long - it takes up to 10 seconds per object. And, that is even more surprising, an object is not remembered after it was recognized. Next reference to its alias in script code forces the recognition again. Another thing that is unusual is that for some windows belonging to application the recognition is fast and for some others it is slow.

 

I have not any guess why this happens. Some time ago this issue encountered after I had installed the new version of TestComplete instead of 14.74. And when I had returned back to 14.74 everything became good.

 

Now I observe this behaviour for both 14.74 and 14.92 versions which I try to use for tests. And one more strange thing is that the tests were running good for current application version for last two weeks.

 

Regards

 

  • brumazz's avatar
    brumazz
    SmartBear Alumni (Retired)

    Hi rvg, 

     

    Have you looked into editing the mapping of those objects?

    It sounds like they are being found, but possibly using the 2nd selector in the name mapping.

    Can you share a screenshot of your log?

    • rvg's avatar
      rvg
      Occasional Contributor

      Hi brumazz,

       

      1) For identifying each object only the unique id is used that is assigned to it by swing. I think, if the problem was in name mapping, it would occur persistently.

       

      2) I am attaching two fragments of the log that refer to the same run of the script. In these fragments the record 'Checking Certificates Tab' is placed to the log by a function which checks controls on specific tab of the window. This tab contains 4 objects of type JTable and 16 objects of type JButton. Function gets the state and  content of these objects and compares the data to state saved previously. During the run the window was opened twice for different tasks. During the first opening the objects recognition was slow. It took 10 seconds per object, so the total time for function call was approximately 3 minutes. For the second time the function call was shorter than 1 second.

       

      Regards

       

      P.S.
      I wonder, is it occasional coincidence that the Auto-wait timeout in Playback section in project properties contains the value of 10000 ms?

       

       

      • rvg's avatar
        rvg
        Occasional Contributor

        It was not a right thought about  Auto-wait timeout. If it was reached the script would be stopped with error message. Most likely delay is a little smaller in my case.

      • brumazz's avatar
        brumazz
        SmartBear Alumni (Retired)

        Hi again,

         

        Thanks for uploading the application and Project.  I was able to do some testing on my side and had no issues with speed of playback.  I will message you direct with a short video of it working.  I would also like to validate that your application has been added to the TestApps section in the project as a starting point.

         
  • MarkHays's avatar
    MarkHays
    Occasional Contributor

    I have seen something similar recently.  What I have been able to speculate is that objects that are hidden, seem to take the object timeout time before they return.  I am performing web testing.   Did seem to happen with a somewhat recent update to test Complete.

    • rvg's avatar
      rvg
      Occasional Contributor

      Thanks,

       

      Your idea is right, as it seems to me. After some experiments it became clear, that in my case the reason of the long time delay is that the objects being recognized are positioned on the window tabs that have no focus. It was possible as the code only needed to read their state, not to change. After adding to my code the swithching to a tab before accessing its controls the script was performed quickly.

      Now I'd like to know - is it a bug of TestComplete or of the application under the test?

      • MarkHays's avatar
        MarkHays
        Occasional Contributor

        You could change the object timeout and see if there is a corresponding change in the object recognition.   I had created a small test that timed how long it took to access of an object.  My findings were that attempting to access an object that was hidden took the entire object timeout time + a small amount, but did not result in an object recognition error.