Forum Discussion
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())
- tristaanogre7 years agoEsteemed 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.
- karkadil7 years agoValued Contributor
I agree with Robert, in most cases it is enough to have the screenshot in case of error only
- shahid247 years agoContributor
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
- shahid247 years agoContributor
Hi ,
Thanks for the reply, would this give two screenshots, actual vs expected?Thanks
Shahid
- tristaanogre7 years agoEsteemed 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.
- karkadil7 years agoValued Contributor
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?
Related Content
Recent Discussions
- 2 days agovladd1