1

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

4

1 回答 1

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

来源

于 2010-05-25T15:49:54.110 回答