Micro Focus QTP (UFT) Forums
QTP Screenshots - Beginner Question - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP Screenshots - Beginner Question (/Thread-QTP-Screenshots-Beginner-Question)



QTP Screenshots - Beginner Question - jimmyc - 03-18-2009

Hi,

I'm new to QTP and have written a function to take a screenshot of an application window and add it to the QTP results file. Here is the code:

Code:
Sub CaptureScreenshot( ByVal strName, ByVal strWindow )

    Dim path_error_file
    path_error_file = "C:\" & strName
    Window(strWindow).CaptureBitmap path_error_file,True
    Reporter.ReportEvent micFail, object_snap, "&amp;<img src='" & path_error_file &"'>"

End Sub

My problem is that the above code works, but my tests are marked as Fail because I use 'Reporter.ReportEvent micFail'. My screenshots get added to the report fine.

But - When use 'Reporter.ReportEvent micPass' or 'Reporter.ReportEvent micInfo', my screenshots get taken and saved, but don't get added to the report file.

Can anybody help me?

Thanks,
Jimmy