Forum Discussion

chicks's avatar
chicks
Regular Contributor
14 years ago

Region checkpoint not matching seeming identical image

I'm trying some record script tests with region checkpoints for the first time to try to verify my google maps images.



I created region checkpoints using the wizard and the select window region option.  When I run the tests, the images do not match.    I get a 73% pixel difference and a 96% color difference when I try to adjust the checkpoint parameters.     I've reviewed the reasons why images don't match and related help entries and not seen anything that seems to correspond.



The first attachment shows the "expected image" and the "actual image" as reported by test complete.

The second attachment shows the comparison mode.  I noticed that the comparison mode shows the map | satellite,   directional compass,

and scale slider match.  This suggests to me that I do have the proper coordinates correct, and I'm not comparing images that are slightly off because of the way they got captured. 



I imagine I'm missing something basic.  Help, advice and suggestions would be greatly appreciated.



Thanks all.



Curt Hicks

9 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Looking at the two images, they are not the same... one seems to be shifted a bit to the east from the other one, hence why they don't match up.
  • chicks's avatar
    chicks
    Regular Contributor
    Whoops ! You're right. I suppose I'll try to capture the images again.   I had not thought that I shifted the image any when I created the checkpoint, but I guess I did.....    I suppose I can try to 'update' them.



    Thanks Robert! 



    Regards, Curt
  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Curt,



    In addition - the Regions.Compare() method has a parameter to report the differences between images to the log. This may help to understand why images were treated as different. See 'Regions.Compare' help topic for more details.
  • chicks's avatar
    chicks
    Regular Contributor
    Thanks Alexei.  I'll take another look at that entry.



    Currently, I have managed to get some region checkpoints to pass.  However, what's happening now is that the area of the webpage I'm checking is not at the top of the webpage.   I have to scroll down on the page to get the entire image.  Then when I draw my checkpoint, the webpage is returning to the top and part of my "baseline" image gets truncated.



    This is also happening to a lesser extent with the image that the baseline is being compared to....
  • chicks's avatar
    chicks
    Regular Contributor
    Since it was just image comparison, I tried to record a script and use a regions checkpoint.  This was when I got the truncation error on the images.

    Then I started using



      var snapshot = locationList_Mapview_canvas().Picture();

      Regions.all_on_50_miles.Check(snapshot,false, false, 91, 10);



    I used update to get the 'all_on_50_miles' image correct the first time.



    This avoided the truncation error, but failed the comparison if the google maps view canvas was not centered perfectly.

    Sometimes, I could see the .Picture line causing the screen to 'jump' or move during the picture capture.  When it jumped, the image comparison consistently failed, though sometimes it failed without a perceptible screen movement.



    After much effort was expended using trial and error to try and get the screen centered properly, and some tinkering with the pixel and color tolerance, I seemed to be getting consistent results.

    However when I moved over to my automated test box, which is using IE8, the image comparison failed.  I can see that the image is shifted slightly.



    I'm guessing image update does not work in Test Execute?


  • Hi Curt,


    You can update images from TestExecute. You just need to prepare your test project:

    * Open your test project in TestComplete.

    * Open the editor of the Stores | Regions project item.

    * Select the Update check box for the images you are going to update.

    * Save the changes.

    Now, open your project in TestExecute, open the Options | Engines | Stores dialog and select the "Update regions" check box. That's all. TestExecute will update the images when you run tests in it.


    You said you had problems with centering the images. Just two quick ideas:

    * As far as I know, Google Maps Image API offers parameters that specify the location and size of the maps to be displayed. Perhaps, you can use these parameters to get the image you need.

    * If you just need to verify that your page displays the correct map, you can store a smaller image to the project's Stores | Regions collection and modify your test so that it searches for this smaller image in the bigger map that is shown. If this sought-for piece is found, you may consider Google displays the appropriate map... For more info on searching the images, see Finding an Image Within Another Image.

  • chicks's avatar
    chicks
    Regular Contributor
    Thanks Alex,



    I'll give the testexecute update a try.



    FYI, The "positioning" of the map problem seems to be NOTpositioning of the google map image within the mapframe, but more positioning of the mapframe on the web page.  i.e, I had to mess with the scroll bar of the web page, not the internal panning of the google map....



    Regards,  Curt
  • I am facing the same problem with an image that gets truncated with Regions.Compare gets the image. The image comparison then fails. Usually, the web page automatically scrolls down when the "Click()" method is called, but not when calling the "Regions.Compare" method.



    See captured image.