Ask a Question

How do i get a screen shot for object cehckpoints?

shahid24
Contributor

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 7
karkadil
Valued Contributor

Re: How do i get a screen shot for object cehckpoints?

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
Community Hero

Re: How do i get a screen shot for object cehckpoints?

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
karkadil
Valued Contributor

Re: How do i get a screen shot for object cehckpoints?

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

shahid24
Contributor

Re: How do i get a screen shot for object cehckpoints?

Hi Robert,

 

Thanks for your reply. I wanted to get a expected vs actual screenshot on all checkpoints. Also I have by default enabled screenshot on error option. Currently TC takes a screen shot of the object like  for exmaple shows the button that is being cheked but not the rest of the screen. hwo can this be done?

 

Thanks,

Shahid

shahid24
Contributor

Re: How do i get a screen shot for object cehckpoints?

Hi ,


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

 

Thanks

Shahid

tristaanogre
Community Hero

Re: How do i get a screen shot for object cehckpoints?

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
karkadil
Valued Contributor

Re: How do i get a screen shot for object cehckpoints?

Hi shahid,

 

I don't really understand what exactly you want to achieve.

 

Let's say the objects are different. You can take the image of the actual object from the screen, but where do you think the expected image will come from (taking into account that you don't want to use Regions and therefore Image comparison)? It is impossible to have EXPECTED images of the object, on the one hand. On the other hand, it is impossible to have screenshots of objects for ALL checkpoints, because some of them simply can't be captured (e.g. file checkpoints, database checkpoints, etc.).

 

Another example: the objects are equal. What do you expect to see in the log? Two similar pictures? An empty picture, which will guarantee that objects are equal? A picture which will display both expected and equal images?

 

In general, can you explain, what is your your task and what exactly you want to see in the log?

cancel
Showing results for 
Search instead for 
Did you mean: