Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
9 years ago

Picture capture time increases during test

I have to resort to text recognition to identify codejock tabs. To find the active tab I then need to test that the background colour of the text object is blue. The picture capture takes about 1 second at the start of the test run but grows exponentially. After I have opened and identified about 50 forms it can take 5 seconds just to capture the picture object. I have seen it take 19 seconds on several runs. This can add up to 15 minutes to each test run.

 

Any ideas why capturing a picture object may take an increasing amount of time? Do I need to flush something periodically?

 

VBScript:

function isFormCurrent(form)
'Tests if the form named has the correct background colour that indicates it is the current form
  isFormCurrent = false
  if len(form)>0 then
    if project.Variables.OpenForms.exists then
      sys.refresh
      set textObj = project.Variables.OpenForms.waitchild("TextObject(""" & form & "*", 0)     
      if textObj.exists then
        'Test if the form is current by inspecting the top left pixel of the tab label against the current form BG colour
        set TabPic = textObj.picture 'THIS IS THE COMMAND THAT TAKES INCREASING TIME TO EXECUTE
        pixColour = TabPic.Pixels(0,0)

        if pixColour = CurrentFormBGColour then
          isFormCurrent = true
        end if
      end if
    end if
  end if
end function

 

I used the above code and made it verbose so that I could surround each line with the following to identify which step was causing the increasing delay each time I opened a new form.

 

startTime = aqDateTime.Time()
...
log.error("DEBUG: isFormCurrent took " & aqConvert.TimeIntervalToStr(aqDateTime.TimeInterval(startTime, aqDateTime.Time()) ) & " to execute step" )

 

 

Thanks,

 

 

 

  • Do you open one window form ontop of another?

    if you do that manually does application working memory increase?

    what if programmetical close entire application and open again?

  • NisHera's avatar
    NisHera
    Valued Contributor

    Do you open one window form ontop of another?

    if you do that manually does application working memory increase?

    what if programmetical close entire application and open again?

    • MulgraveTester's avatar
      MulgraveTester
      Frequent Contributor

      Thanks NisHera,

       

      Restarrting the test application at intervals did speed up the test run. It went from 23 minutes to 12 minutes.

      Yes all forms open on top of eachother but the tab control is a separate code-jock object. None of the text objects that I am capturing overlap.

       

      TestComplete finds the text object instantly. Only then do I want its picture so that I can get the colour of one pixel. It's a simple case of taking a screen shot with an x/y range defined by the text object. Even manually using PrintScreen and pasting the screen grab into Paint is faster than 19 seconds.

       

      I don't know if this is an issue with TestComplete or the test application.

       

      Thanks for your feedback.

      • NisHera's avatar
        NisHera
        Valued Contributor

        I have experienced when there are complex forms, TC tends to take time to read objects. And probably seems delaying each other. In which case if close either TC or application it gets back on track. Don’t know whether it’s a memory leak or something.