将HP QC缺陷数据导出到Excel

时间:2012-06-04 00:41:35

标签: testing qa qc hp-quality-center

在工作中,一位同事将hp qc中的缺陷数据复制并粘贴到excel,这需要她的年龄......这让我很生气!

无论如何从hp qc导出数据到excel?它只需要转储缺陷列表及其相关字段,如Id,日期,摘要,分配给等等....

必须有一种方法可以导出到excel ...

7 个答案:

答案 0 :(得分:2)

是的,肯定有办法导出这些缺陷。

  1. 过滤掉您需要的所有缺陷。或者你可以突出你需要的那些。

  2. 在菜单栏中(据我记得它是“缺陷”菜单项,但我可能错了) - >有出口选项。

答案 1 :(得分:2)

您可以从QC本身导出到Excel。

缺陷=>出口=>全部/选定。

答案 2 :(得分:1)

我不确定这是否有用。要下载过滤后的缺陷,可以转到缺陷 - >分析(在顶部菜单上) - >项目报告 - >所选报告 - >然后选择您需要的格式。

对于excel提取,缺陷 - >缺陷(在顶部菜单上) - >出口

答案 3 :(得分:1)

我写了一个代码,它将连接到ALM 12.53并将缺陷或任何其他报告导出到Excel中。您需要在Excel 2013中使用Tool => Reference..OTA COM类型库检查。我遇到了HTML代码问题,因此我在下面添加了几行来从Excel字段中删除HTML标记。

Sub Main()
Const QCADDRESS = "http://xxx:xxx/qcbin"
Const DOMAIN = "xxxx"
Const PROJECT = "xxxx"
Const QCUSR = "xxxx"
Const QCPWD = "xxxx"

Dim QCConnection, com, recset
Dim XLS, Wkb, Wks, i

Set QCConnection = CreateObject("TDApiOle80.TDConnection")

QCConnection.InitConnectionEx QCADDRESS
QCConnection.Login QCUSR, QCPWD
QCConnection.Connect DOMAIN, PROJECT
QCConnection.IgnoreHtmlFormat = True
Set com = QCConnection.Command


com.CommandText = "SELECT BUG.BG_BUG_ID /*Defect.Defect ID*/ as     defectid  , " _
                & "BUG.BG_STATUS /*Defect.State*/ as state ," _
                & "BUG.BG_USER_TEMPLATE_15 /*Defect.Root Cause*/ RootCause, " _
                & "BUG.BG_USER_02 /*Defect.Assigned To*/ as AssignedTo, " _
                & "BUG.BG_DETECTION_DATE /*Defect.Detected on Date*/ as detectiondate, " _
                & "BUG.BG_USER_01 /*Defect.Application Involved*/  as ApplicationInvolved, " _
                & "BUG.BG_SUMMARY /*Defect.Summary*/  as summary   , " _
                & "BUG.BG_DESCRIPTION /*Defect.Description*/ as description, " _
                & "BUG.BG_SEVERITY /*Defect.Severity*/ as  severity , " _
                & "BUG.BG_DETECTED_BY /*Defect.Submitter*/ as submitter , " _
                & "BUG.BG_RESPONSIBLE /*Defect.Assignee*/    as Assignee, " _
                & "BUG.BG_USER_04 /*Defect.Workstream*/   as workstream , " _
                & "BUG.BG_USER_03 /*Defect.Commited Resolution Date*/ as CommitedResolutionDate, " _
                & "BUG.BG_USER_05 /*Defect.Vendor Ticket Number*/   as Vendorticketnumber, " _
                & "BUG.BG_DEV_COMMENTS /*Defect.Comments*/ as comments " _
                & "FROM        BUG /*Defect*/ " _
                & "where    BG_Status = 'Cancelled' " _
                & "order by   BUG.BG_DETECTION_DATE,BUG.BG_USER_TEMPLATE_15"


Set recset = com.Execute

Set XLS = CreateObject("Excel.Application")
XLS.Visible = False
QCConnection.IgnoreHtmlFormat = True
Set Wkb = XLS.Workbooks.Add
Set Wks = Wkb.Worksheets(1)
'Wks.Name "DataFromBugQuery"

i = 1

Wks.Cells(i, 1).Value = "Defect ID"
Wks.Cells(i, 2).Value = "State"
Wks.Cells(i, 3).Value = "Root Cause"
Wks.Cells(i, 4).Value = "Assigned To"
Wks.Cells(i, 5).Value = "Detection Date"
Wks.Cells(i, 6).Value = "Application Involved"
Wks.Cells(i, 7).Value = "Summary"
Wks.Cells(i, 8).Value = "Description"
Wks.Cells(i, 9).Value = "Severity"
Wks.Cells(i, 10).Value = "Submitter"
Wks.Cells(i, 11).Value = "Assignee"
Wks.Cells(i, 12).Value = "Workstream"
Wks.Cells(i, 13).Value = "Commited Resolution Date"
Wks.Cells(i, 14).Value = "Vendor Ticket Number"
Wks.Cells(i, 15).Value = "Comments"

If recset.RecordCount > 0 Then
i = 2
recset.First
Do While Not (recset.EOR)


Wks.Cells(i, 1).Value = recset.FieldValue(0)
Wks.Cells(i, 2).Value = recset.FieldValue(1)
Wks.Cells(i, 3).Value = recset.FieldValue(2)
Wks.Cells(i, 4).Value = recset.FieldValue(3)
Wks.Cells(i, 5).Value = recset.FieldValue(4)
Wks.Cells(i, 6).Value = recset.FieldValue(5)
Wks.Cells(i, 7).Value = recset.FieldValue(6)
Wks.Cells(i, 8).Value = recset.FieldValue(7)
Wks.Cells(i, 9).Value = recset.FieldValue(8)
Wks.Cells(i, 10).Value = recset.FieldValue(9)
Wks.Cells(i, 11).Value = recset.FieldValue(10)
Wks.Cells(i, 12).Value = recset.FieldValue(11)
Wks.Cells(i, 13).Value = recset.FieldValue(12)
Wks.Cells(i, 14).Value = recset.FieldValue(13)
Wks.Cells(i, 15).Value = recset.FieldValue(14)


Dim r As Range
Wks.Cells(i, 8).NumberFormat = "@"  'set cells to text numberformat
Wks.Cells(i, 15).NumberFormat = "@"
With CreateObject("vbscript.regexp")
.Pattern = "<[^>]+>|;"
.Global = True
 For Each r In Wks.Cells(i, 8)
 r.Value = .Replace(r.Value, "")

Next r
For Each r In Wks.Cells(i, 15)
r.Value = .Replace(r.Value, "")
Next r
End With

Text = Wks.Cells(i, 8).Value
Wks.Cells(i, 8).Value = Replace(Text, "&nbsp", "")
Text = Wks.Cells(i, 8).Value
Wks.Cells(i, 8).Value = Replace(Text, "&quot", "'")

Text = Wks.Cells(i, 15).Value
Wks.Cells(i, 15).Value = Replace(Text, "&nbsp", "")
Text = Wks.Cells(i, 15).Value
Wks.Cells(i, 15).Value = Replace(Text, "&ltv6ucbs&gt", "")

i = i + 1
recset.Next
Loop

Wkb.SaveAs "C:\Users\xxxx\Downloads\Files\Cancelled_Defects.xls"
End If

Wkb.Close
XLS.Quit

QCConnection.Disconnect

Set recset = Nothing
Set com = Nothing
Set QCConnection = Nothing
Set XLS = Nothing
Set Wkb = Nothing
Set Wks = Nothing
End Sub

答案 4 :(得分:1)

所有有效选项,我还会再添加一个: 分析菜单中的Excel查询选项。

仪表板&gt;分析视图&gt;添加按钮&gt;新的Excel报告

您必须提供报告的名称,然后确认。

在“查询”窗口中,您可以键入查询。如何加入表格?请参阅帮助中的数据库方案&gt;文档库&gt; HP ALM项目数据库参考

您可以添加后处理来构建Excel。

添加的每个查询都将登陆excel中的新标签。

通过这种方式,您可以撰写非常复杂的Excel报告。

请注意:添加后处理时,您需要创建一个xlsm文件,并且需要启用宏。

答案 5 :(得分:0)

您可以点击Defects --> Export --> ALLSelected过滤并选择缺陷,然后保存文件。

我还有一个问题,比如..有什么方法可以保存除XLS格式以外的文件以CSV或XML格式保存。有人可以指导我..谢谢

答案 6 :(得分:0)

1.登录HP QC

2.转到defects(左侧菜单)

3.筛选您的缺陷

4.转到顶行的缺陷菜单

5.单击并选择Export按钮