Micro Focus QTP (UFT) Forums
Snapshots - Test Results - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Snapshots - Test Results (/Thread-Snapshots-Test-Results)



Snapshots - Test Results - Bhadra - 11-10-2011

Hi Ankur,

I would like to check with you on this, How can we take a snapshot for every statement we mention in a script and store it in a specific location. Any idea on this?

Thanks,
Bhadra.


RE: Snapshots - Test Results - vinod123 - 11-11-2011

C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\collections\Action0\SnapShots
Here collections name is the project name just open the location at ur end


Regards
Thomas


RE: Snapshots - Test Results - Bhadra - 11-12-2011

Hi Thomas, Thanks for your reply,

Under Action0 of my test results does not have snapshots folder, thats the issue. Please suggest if you have any other idea.


RE: Snapshots - Test Results - vinod123 - 11-14-2011

if the snapshots are not working i will send a code capturing screenshots where ever u want it contains functions should be registered at the start of script and capture screenshot line for capturing the snapshot of the script in image form just wait i will send that in next post



With Regards
Thomas Vinod




RE: Snapshots - Test Results - Bhadra - 11-14-2011

Thanks man:-) I am waiting for your reply.


RE: Snapshots - Test Results - vinod123 - 11-14-2011

you should start with following code
Code:
RegisterUserFunc "Page", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Browser", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Frame", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Dialog", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "swfWindow", "CaptureScreenshot", "CaptureScreenshot"

use the following line where you want take screenshot or snapshot

Code:
Browser("micclass:=Browser").Page("micclass:=Page").CaptureScreenshot micPass, "<h4 align = ""Center"">Page SuccessFully Displayed</h4>"

The below code is a library file. Add the library file to the script

Code:
Public Sub CaptureScreenshot( ByRef Sender, ByVal micStatus, ByVal descriptionStr )  
    Dim dateTimeNow, fileNameStr, divDesc, caption
    Dim dicMetaDescription, qtp
    dateTimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )    
    fileNameStr = Reporter.ReportPath & "\" & dateTimeNow & ".png"    
    Set qtp = CreateObject( "QuickTest.Application" )  
    qtp.Visible = False
    Wait 0, 500    
    If IsObject( sender ) Then      
    Sender.CaptureBitmap fileNameStr, True      
    caption = Sender.ToString & " - Capture Bitmap"    
Else      
    Desktop.CaptureBitmap fileNameStr, True      
    caption = "Desktop - Capture Bitmap"    
End If
    qtp.Visible = True
    divDesc = "<table align='center' border='5' cellpadding='1' cellspacing='1' width='100%' title='" & fileNameStr & "' frame='hsides'>" & _              
                   "<caption>" & caption & "</caption>" & _              
                   "<thead><tr><th>Application Exception Description</th></tr></thead>" & _              
                   "<tfoot><tr><td align='center'><img border='2px' src='" & fileNameStr & "' /></td></tr></tfoot>" & _              
                   "<tbody><tr><td>" & descriptionStr & "</td></tr></tbody></table>"    
    Set dicMetaDescription = CreateObject( "Scripting.Dictionary" )    
    dicMetaDescription( "Status" ) = micStatus    
    dicMetaDescription( "PlainTextNodeName" ) = "ApplicationException"    
    dicMetaDescription( "StepHtmlInfo" ) = "<DIV align=center>" & divDesc & "</DIV>"  
    dicMetaDescription( "DllIconIndex" ) = 205    
    dicMetaDescription( "DllIconSelIndex" ) = 205
    dicMetaDescription( "DllPAth" ) = EnVironment( "ProductDir" ) & "\bin\ContextManager.dll"  
    Call Reporter.LogEvent( "User", dicMetaDescription, Reporter.GetContext )
    dicMetaDescription("User") =  EnVironment ("dicMetaDescription")
    dicM
End Sub

Bhadra I am sure the code will work because i used it in so many projects



RE: Snapshots - Test Results - Bhadra - 12-15-2011

I dont want to keep any statement like capture snapshot, just how it displays in results window for every statement in the script, the same way i need. Is it possible?


RE: Snapshots - Test Results - Sathiya - 12-15-2011

Hi friend,
may i know the difference between Desktop.CaptureBitmap and capture screenshot?


RE: Snapshots - Test Results - vinod123 - 11-03-2014

@ 'Bhadra'


The Capture snapshot statement is used for displaying the screenshot in the results file. If you do not want to use use the different name for the function in the library and use the same name in the in the script

@ 'Sathiya'

There is difference i used the capture screenshot as name of the function in the library so i used the same thing in the script