Forum Discussion

shahid24's avatar
shahid24
Contributor
7 years ago

How do i get a screen shot for object cehckpoints?

Hi,

 

I would like to get screenshots ( Whole Screen)  for object checkpoint similar to ones for mouse clciks. I would like it to show expected image and actual image. I dont want to add reigon checkpoints, any ideas.

 

Thanks,

Shahid

7 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor

    I suppose you can use OnLogCheckpoint event to create screenshots for every checkpoint.

    Just create event handler function and put there

     

    Log.Picture(Sys.Desktop.Picture())

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Do you need the screenshot for a success or is it sufficient to get the screenshot for an error?  If error screenshots are what you need, you can do that for all errors for your project under Tools | Current Project Properties | Project | Playback.  There's a checkbox that says "post image on error" that will take a screenshot of your current desktop whenever an error is logged.

       

      Personally, I choose the path of "less is more" with regards to writing to the log.  If some test or validation passes within the larger test case, I choose not to log anything.  I really only need to know when something fails and, if it does, details about the failure.  So, since a failed object checkpoint can automatically generate a screenshot (see above), there's no need to do any other work to do so.

      • karkadil's avatar
        karkadil
        Valued Contributor

        I agree with Robert, in most cases it is enough to have the screenshot in case of error only

    • shahid24's avatar
      shahid24
      Contributor

      Hi ,


      Thanks for the reply, would this give two screenshots, actual vs expected?

       

      Thanks

      Shahid

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Why do you need the visual image screenshot of actual vs. expected for instances where the test passes?  If it passes, that means everything is there... Actual = Expected.  If it fails, as with an error, then  the onlogerror screenshot will show you the Actual and the test log, in the information in the log, will detail what doesn't match.

         

        For that matter, an image comparison of actual vs expected is moot for object checkpoints.  An object checkpoint takes a snapshot of the object and your selected properties and compares that snapshot to what's actually rendered in your application.  If you pick your properties within the checkpoint properly, screenshots don't matter.  If you truly want an actual vs. expected image, then your best bet is to use region checkpoints/image comparison.