Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to capture screen shots when an error occurs?




225
views
asked marvit August 26, 2014 03:58 AM  

How to capture screen shots when an error occurs?


           

1 Answers



 
answered By Dharma   0  
Capture and report error image on QTP result:
Error handling,logging and reporting are prime challenges while developing automation framework.Our automated tests will only provide a fruitful result if it gives enough information about the test confidence (or coverage) of AUT;else Record and Run automation will only be a mission to see how software uses or manipulates software.
Image Capture:Before running the code,let’s assume the disk drive is empty enough to store our captured images.
and last but not the least,make sure that the path is relative.

Here “/” and “:” sign is replaced by “-” because file name doesnt accepts these characters



Function CaptureImageonError()

Dim moment
Dim sMyfile

moment=Now() 'displays the current date and time
sMyfile= moment&".png"
Msgbox sMyfile
sMyfile = Replace(sMyfile,"/","-") 'removing special char / & :
sMyfile = Replace(sMyfile,":","-")
sMyfile= "C:"&sMyfile 'Path where file would be saved

Desktop.CaptureBitmap sMyfile,true
End Function


flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert