Micro Focus QTP (UFT) Forums
Bitmap Image - 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: Bitmap Image (/Thread-Bitmap-Image)



Bitmap Image - Rajesh - 05-15-2008

Hi Ankur,


Is it possible to capture the bitmap image of our application and place the same in to the report sheet.

My application is a jave based application, in certain place i might get an expected negative result. In such case I need to capture the bitmap image and put the same in to the report sheet (report warning).

What I tried is
RV = JavaWindow("Project").CaptureBitmap("C:\Rajesh Training\Exported mlm\Compilation Error.bmp")
Reporter.ReportEvent micWarning, "MLM has a compilation error, please see the error message in the location C:\Rajesh Training\Exported mlm\Compilation Warning.bmp.", RV


Here RV is a variable which is storing the bitmap image in the above location but it is not displaying the image in the report sheet.

It is displaying RV = Empty.

Please let me know your comments.


RE: Bitmap Image - Ankur - 05-21-2008

Nice question...

you can find the solution here... How to capture error screenshot?

In case you want to see screenshot for all errors you can simply go to Tools > Options > Run tab and check "Save still image capture to results" and select "For Errors" from dropdown.


RE: Bitmap Image - Rajesh - 05-22-2008

Thank you very much,

I will try your method and let you know how it works.

once again thanks, its a great help.


RE: Bitmap Image - Rajesh - 05-22-2008

Hi Ankur,

I have tried with the above method

Code:
Errorpath = "C:\Rajesh Training\Exported mlm\Compilation Error.bmp"
JavaWindow("MainWindow").CaptureBitmap Errorpath,True
Reporter.ReportEvent micFail,object_snap,"&nbsp<img src='" & Errorpath &"'>"

For the above code I was geting declaration error (object_snap is not declared)

I though it may be the report description so I have modified the code as

Code:
Errorpath = "C:\Rajesh Training\Exported mlm\Compilation Error.bmp"
JavaWindow("MainWindow").CaptureBitmap Errorpath,True
Reporter.ReportEvent micFail,"The expected compilation error is displayed","&nbsp<img src='" & Errorpath &"'>"

Finally I got a result checkpoint failed but unfortunately I didnt see the captured bitmap image in the result sheet.

please let me know what is "object_snap".
Is it a variable? if so what is stored in it and what is the use of it.

Thanks in advance.


RE: Bitmap Image - Ankur - 05-22-2008

no need to worry about that...if you see the Reporter.ReportEvent syntax... it's just a step name...you can customize it as you want

I see that there is a space in your image doc name ...remove the space or add some character like underscore. For ex: compilation_error.bmp


RE: Bitmap Image - Rajesh - 05-22-2008

Hi Ankur,

I have removed that space on the variable and tried many times.
Even now my result sheet is not displaying the captured bitmap
I have tried by modifing the last line with and without space.

Code:
errorpath = "C:\Rajesh Training\Exportedmlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&nbsp<img src='"&errorpath&"'>"

With Space:

Code:
errorpath = "C:\Rajesh Training\Exportedmlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&nbsp<img src='" & errorpath &"'>"

I am geting just a text result as how it is written in the report.

If possible could you please attach your result sheet so that i can see that once.
My application is a Java based application, Is a this a reason I am not geting the expected result ? I am not sure.
Please let me know your comments.


RE: Bitmap Image - Rajesh - 05-25-2008

Hi,

Do u got any solution for the above issue.......


RE: Bitmap Image - Ankur - 05-26-2008

my bad...I thought it would work with &nbsp; also but isn't. You can change it to &amp;
Reporter.ReportEvent micFail,"Compilation error is displayed.", "&amp;<img src='" & errorpath & "'>"

Now it should work... I have made changes to my post also...Thanks for pointing that out.


RE: Bitmap Image - Rajesh - 05-26-2008

Hi Ankur,

Thank you very much for your reply,

Finally the code is working

Hay man The bitmap capture is working, I have gone through your post once again and used the below code.

Code:
errorpath = "C:\Rajesh Training\Exported mlm\CompilationWarning.bmp"
JavaWindow("MainWindow").CaptureBitmap errorpath,True
Reporter.ReportEvent micFail,"Compilation Error","&lt;<img src='" & errorpath &"'>&gt;"