QC导出到excel文件所使用的插件,欢迎大家下载,导出缺陷、用例所必须
相信有很多同学会要用这个功能。
这个方法无法导出测试用例的层级,也无法导出测试用例的步骤,只能导出视图上已有字段内容。
1、进入测试计划,点击视图->测试网格
2、填写筛选条件,选出你要的测试用例
3、如要全部导出,右键点击一条测试用例选导出->全部,输入文件名,默认.xls文件 保存即可
如要部分导出,用ctrl或shift选中你要导出的用例,右键点击一条选中的tc选导出->选定,输入文件名,默认.xls文件 保存即可
这时候,查看导出的excel,貌似大部分会是乱码。
把qc服务器上bug输出到本地excel表中,利用Quality Center Open Test Architecture API -OTA COM 9.0编写脚本代码读取服务器上bug列表,以下代码在vb中编写,调试通过。
注意:The OTAClient.dll (OTA COM 9.0 Type Library) 从服务器上下载后保存在你本机文件夹
Program FilesCommon FilesMercury InteractiveQuality Center下。
代码:
Dim QCConnection As TDConnection
Dim BugFactory As BugFactory
Dim BugList
Dim Bug As Bug
Dim Row As Integer
Dim Excel, Sheet
On Error GoTo makeConnectionErr
If (QCConnection Is Nothing) Then
Set QCConnection = New TDAPIOLELib.TDConnection
End If
If (QCConnection Is Nothing) Then GoTo makeConnectionErr
QCConnection.InitConnectionEx "http://192.168.1.180:8080/qcbin"
QCConnection.Login "pcl", ""
'DEFAULT = Domain, QualityCenter_Demo = Project
QCConnection.Connect "深圳博为峰信息技术有限公司", "mis"
If QCConnection.Connected = True Then
Debug.Print "Connection Success"
If QCConnection.LoggedIn = True Then
Debug.Print "Logedin"
If QCConnection.ProjectName <> "mis" Then
If QCConnection.ProjectConnected = True Then
Debug.Print "ok"
End If
End If
End If
Else
MsgBox "Connection Failed"
End If
'Check status.
Set BugFactory = QCConnection.BugFactory
Set BugList = BugFactory.NewList("")
Set Excel = CreateObject("Excel.Application")
Excel.WorkBooks.Add
Set Sheet = Excel.ActiveSheet
Row = 1
Sheet.Cells(Row, 1).Value = "BG_BUG_ID"
Sheet.Cells(Row, 2).Value = "Summary"
Sheet.Cells(Row, 3).Value = "DetectedBy"
Sheet.Cells(Row, 4).Value = "Priority"
Sheet.Cells(Row, 5).Value = "Status"
Sheet.Cells(Row, 6).Value = "AssignedTo"
Row = 2
For Each Bug In BugList
Sheet.Cells(Row, 1).Value = Bug.Field("BG_BUG_ID")
Sheet.Cells(Row, 2).Value = Bug.Summary
Sheet.Cells(Row, 3).Value = Bug.DetectedBy
Sheet.Cells(Row, 4).Value = Bug.Priority
Sheet.Cells(Row, 5).Value = Bug.Status
Sheet.Cells(Row, 6).Value = Bug.AssignedTo
Row = Row + 1
Next
Excel.ActiveWorkbook.SaveAs ("c:QualityCenter_DEFECTS.xls")
Excel.Quit
Set Excel = Nothing
Set BugList = Nothing
QCConnection.ReleaseConnection
Set QCConnection = Nothing
makeConnectionErr:
Debug.Print Err, fName, Err.Descrīption & vbCrLf & errmsg