Forum Discussion

AndrewCast's avatar
AndrewCast
Contributor
6 years ago
Solved

Checking if anything has changed after a script line

Hi everyone,   I'm testing a graphic extensive application, and I'm using Python to script all of my test cases.   Let's say I have to run a command X that would result in a small window atta...
  • tristaanogre's avatar
    6 years ago

    Sure... Check out the Regions object and related methods

     

    https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/stores/regions/methods.html

     

    Basically, you're going to call Regions.Add to add the "before" picture.  Then, use Regions.Compare to compare the stored image with the real-time image from the application.

     

    Now... my druthers... I don't like using regions to do stuff because they are so dependent upon pixel depth, screen resolution, minor positioning, fonts, etc....  All SORTS of things that could cause a false difference to show up.  My suggestion would be to check for existance... I'm assuming that the small window didn't exist before the command... rather than taking, what is effectively, as screenshot and comparing it, I'd actually check to see if the new window is present and, if so, if it's Top and Left properties are within an expected range for it to be on the right side of the screen... perhaps check the TOTAL screen resolution and then make sure the LEFT property is the left side of the screen minus the Window width... or maybe there is some property on the window that indicates "Docked" or something like that...  All sorts of ways of checking the presence and location of an object without having to do screen image comparisons.