Forum Discussion

sameerjade's avatar
sameerjade
Frequent Contributor
7 years ago

Image comparison, color tolerance

Hello All,

 

I am doing some image comparisons of some windows where some text is selected and highlighted in blue. I am using the TestComplete image comparison checkpoint. The actual image does not seem to be consistent as the highlighted blue color sometimes comes as slightly darker and sometimes slightly lighter and therefore my test fails. I increased the color tolerance from initial zero to 17, 25 but it still sometimes fails. I don't want to just increase the tolerance value to a high value to make it pass. Is there a better way to do this such that it is not affected by the change in color brightness. In this case of image comparison, I only care about the accuracy of the text in the window (buttons, text boxes etc).

 

Thank you!

 

Sameer

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    This is one reason why, for most situations, I don't depend upon image comparisons for doing my tests.  Different resolutions, color saturations, etc., make for all sorts of mess when doing those comparisons.

     

    If all you're concerned with is the text content of the component, I would look at using a property checkpoint or similar comparison on the component's text, contentText, wText, Caption, or some similar property, depending upon the component.  This will validate the text without needing to involve anything like color tolerance.

    • sameerjade's avatar
      sameerjade
      Frequent Contributor

      Thanks, Robert for the reply. I did try using the property checkpoint ('check object content or properties' > 'compare a collection of object properties' since I want to test several buttons, text boxes, header text etc). It creates an object and gives me a script line which I put inside my script. When I run the test, this check passes but I don't really know what exactly it tested. For eg, in image comparison, we can see the actual and expected images. So, I tried to change the baseline object by changing a numerical text value in the window to be tested, created a new property checkpoint which gave me a new script line. Now, when I run the test, I expected it to fail since I changed my baseline to a new one but my actual is the same because of the test steps are still the same. However, the test still passed. Now, I am suspicious what the property checkpoint it really testing. Does it only test things like, window height, width etc?

       

      Thank you!

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Are you doing script code or keyword tests?

    In any case, it you want to see if a checkpoint fails if an object changes, you don't make a new checkpoint. The checkpoint is a comparison of the value of a property in your AUT to a set value to test.

    In code, if you do a property checkpoint, it might look like this.

    aqObject.CheckProperty(Aliases.MyAUT.myButton, "Label", 0, "MyLabel", true)

    This line of code will check the Label property of the my Button object. If the value of the Label property equals "MyLabel" the log will report a pass. If the value does not equal "MyLabel", it will report an error to the log.

    The property checkpoint in Keyword tests is analogous to this code line. Any property on an object can be checked in this way.
    • sameerjade's avatar
      sameerjade
      Frequent Contributor

      I am doing script code test. Thanks, I will try that.