【问题标题】:Robot Framework and HPQC integration机器人框架和 HPQC 集成
【发布时间】:2016-07-07 09:20:38
【问题描述】:

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

问候, 乌尼

【问题讨论】:

  • 我已经构建了库以将 ALM 与 DVO、Jenkins 等工具集成。我不熟悉机器人框架,文档显示该框架是使用 Python 实现的。因此,我保证通过 ALM REST API 使用 Python/UNIX Shell/Java 是可能的。

标签: robotframework hp-alm vapix


【解决方案1】:

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

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

谢谢, 达摩达兰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

【讨论】:

    猜你喜欢
    • 2021-05-02
    • 2016-03-12
    • 2018-11-15
    • 2017-05-28
    • 2012-02-24
    • 1970-01-01
    • 2018-11-15
    • 1970-01-01
    • 2015-10-06
    相关资源
    最近更新 更多