views:

86

answers:

1

how to send QuickTest Professional (QTP) test results to an .xls file through vb script

+1  A: 

You can modify the pair of functions below to suit your needs.

This function initializes an Excel spreadsheet.

Function initOutExcel(sTablePath)
  Datatable.addSheet "Results"
  Datatable.importSheet sTablePath, "Results","Results"
  iParamCount = Datatable.getSheet("Results").getParameterCount
  if iParamCount = 0 Then
    Datatable.getSheet("Results").addParameter "S.No",""
    Datatable.getSheet("Results").addParameter "Status",""
    Datatable.getSheet("Results").addParameter "Functionality",""
    Datatable.getSheet("Results").addParameter "Description",""
  End If
   Datatable.ExportSheet sTablePath,"Results"
End Function

This function appends the Result of a Test to the end of the existing results.

Function WriteResults(sTablePath,sStatus,sFunctionality,sDescription)
  Datatable.addSheet "Results"
  Datatable.importSheet sTablePath, "Results","Results"
  iRowCount = Datatable.getSheet("Results").getRowCount
  Datatable.getSheet("Results").setCurrentRow(iRowCount+1)
  Datatable("S.No","Results") = iRowCount+1
  Datatable("Status","Results") = sStatus
  Datatable("Description","Results") = sDescription
  Datatable("Functionality","Results") = sFunctionality
  Datatable.ExportSheet sTablePath,"Results"
End Function

(Source)

Dolph