将QuickTest Professional测试结果转换为.xls文件

时间:2010-05-25 15:41:23

标签: vbscript qtp

如何通过vb脚本将QuickTest Professional(QTP)测试结果发送到.xls文件

1 个答案:

答案 0 :(得分:2)

您可以修改以下功能对以满足您的需求。

此功能初始化Excel电子表格。

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

此函数将测试结果附加到现有结果的末尾。

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