0

我正在尝试使用HP ALM 中的VAPI-XP工具将HP Application Lifecycle Management (HP ALM)机器人框架集成。我想知道你们中是否有人以前尝试过,如果有,请分享您的方法。

问候, 乌尼

4

1 回答 1

0

我正在发布我为我的项目创建的脚本(要在 VAPI-XP Testscript 窗格中编写的 VBScript),以将 Robot FW 与 Quality Center 集成。这将创建一个动态批处理命令行文件,当脚本从 QC 触发时执行机器人框架脚本,并将 RF html 结果文件作为附件发布到 QC 测试运行实例。

您可以浏览脚本并根据需要进行修改。

谢谢, Damodharan B

' ----------------------------------------------------
' Main Test Function
' Debug - Boolean. Equals to false if running in [Test Mode] : reporting to Quality Center
' CurrentTestSet - [OTA COM Library].TestSet.
' CurrentTSTest - [OTA COM Library].TSTest.
' CurrentRun - [OTA COM Library].Run.
' ----------------------------------------------------
Sub Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun)
  On Error Resume Next
  TDOutput.Clear

  ' Run Test
  strMainDir = "C:\Robot-QC"
  strTestDir = strMainDir & "\Execution"
  strBatchFileDir = strTestDir & "\BatchFiles"
  strResultDir = strTestDir & "\Results"

  strTestName = "TestCase1"
  strResultPath = strResultDir & "\" & strTestName & "_Res"
  strExecutionLogPath = strResultPath & "\ExecutionLog.txt"

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If objFSO.FolderExists(strResultPath) Then
     objFSO.DeleteFolder strResultPath, True
  End If
  objFSO.CreateFolder strResultPath

  'If Execution Directly From QC, Creates Test Batch File
  If Not objFSO.FileExist(strBatchFileDir & "\" & strTestName & ".bat")Then
     'Write Batch File for Test
     Set objTestBatchFile = objFSO.OpenTextFile(strBatchFileDir & "\" & strTestName & ".bat", 2, True)
     objTestBatchFile.WriteLine "cd " & strTestDir
     objTestBatchFile.WriteLine "pybot -t " & strTestName & " --outputdir Results\" & strTestName & "_Res " & "TestCases.txt"
     objTestBatchFile.Close
     Set objTestBatchFile = Nothing
  End If

  XTools.run strBatchFileDir & "\" & strTestName & ".bat", "", -1
  XTools.Sleep 1000

  ' Update Run Status
  strTDOutPut = Replace(TDOutput.Text, " ", "")
  If InStr(1, strTDOutPut, strTestName & "|PASS|") = 0 Then
     CurrentRun.Status = "Failed"
     CurrentTSTest.Status = "Failed"
  End If
  'Log Command Prompt Output
  Call Log_Output(objFSO,strExecutionLogPath)

  'Upload Result Files
  Set objFolder = objFSO.GetFolder(strResultPath & "\")
  Set objFiles = objFolder.Files

  For Each oFile In objFiles
       Set objRunAttach = CurrentRun.Attachments
       Set newAtt = objRunAttach.AddItem(Null)
       newAtt.FileName = strResultPath & "\" & oFile.Name
       newAtt.Type = 1
       newAtt.Post
       newAtt.Refresh
  Next

  Set newAtt = Nothing
  Set objRunAttach = Nothing
  Set objFiles = Nothing
  Set objFolder = Nothing
  Set objFSO = Nothing

  Err.Clear
  On Error Goto 0
End Sub

Sub Log_Output(objFSO,strExecutionLogPath)
   Set objOutputFile = objFSO.OpenTextFile(strExecutionLogPath, 2, True)
   objOutputFile.Write TDOutput.Text
   objOutputFile.Close
   Set objOutputFile = Nothing
End Sub
于 2016-12-07T09:29:46.010 回答