Micro Focus QTP (UFT) Forums
How to capture QTPs results for each step - 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: How to capture QTPs results for each step (/Thread-How-to-capture-QTPs-results-for-each-step)



How to capture QTPs results for each step - martinangello - 07-20-2009

Is there a way we can capture QTP's "result" and "Details" for each step, so that it can be passed onto an excel? Appreciate all your help... thanks


RE: How to capture QTPs results for each step - Osbornebckk - 07-24-2009

Couldn't you just say...
Code:
If ..("Window"). ..("Screen"). ..("Field"). = "desired result" Then
DataTable("Results1", dtGlobalSheet) = "Pass"
Else
DataTable("Results1", dtGlobalSheet) = "Fail"
End If
..("Window"). ..("Screen"). ..("Field"). Output CheckPoint("Details1", dtGlobalSheet)

I've used this simple 'if' statement to do something similar to what you want.

The other way I can think of is to use QC to run the test from. QC will store the results and the details it used to pass/fail that test for each step.

I hope this helped.


RE: How to capture QTPs results for each step - martinangello - 09-02-2009

yeah, i've done that... But sometimes the framework we build, or what I've built, is not so foolproof... so i jus wanna capture QTP's results too and check if my framework is in sync... once things are stramlined i wudn need it anyway... so if anyone has an answer, pls help


RE: How to capture QTPs results for each step - basanth27 - 09-02-2009

If your requirement is to pass the values to an external excel sheet then you will have to exploit the Excel COM object.
Code:
Set oExcel = CreateObject("Excel.Application")
Set oWorkbook  = oExcel.Workbooks.Open(sExcelpath)
Set oWorksheet = oWorkbook.Worksheets(1)

If ..("Window"). ..("Screen"). ..("Field"). = "desired result" Then
oWorksheet.Cells(1, 4).Value = "Pass"
Else
oWorksheet.Cells(1, 4).Value = "Fail"
End If

This would write in the 1st row, 4th column provided that is your results column. If you want to write it for all the tests please iterate through a For loop and use the counter in place of the row.


RE: How to capture QTPs results for each step - martinangello - 09-08-2009

Basanth,
I do not want write my own 'Pass' or Fail result based on conditions.... I want to capture QTP's results; the one that u see at the end of a run, wherein each step would have Pass, Done, Fail, Warning... Let me give an instance where the user and QTP can vary... I'm a novice, and while writing a click function, all i wrote was
if obeject.exist then
object.click
result="pass"
else result="fail"

Now, I've made the mistake of not checkin if the object is enabled.. so when i run this script, I wud get a Pass result (as programmed) where as QTP will fail the click event as the object is disabled... Now, all i wanna do is capture this QTP's result; here "FAIL".... Also, reporter.RunStatus is not what I want, cos that gives me the overall Run status... I want the status for every action performed.... Any help?