Sharing the function to extract defects in Excel from QC. Need to change the following things specific to your project in the excel sheet
QC - URL
QC - Username and password
QC - Domain and project for which you need defects
You can filter defcts by proding search criteria
To this Excel macro click on ExtractDefects button.
----------------------------------------------------------------------------------------------------------------------------
Sub DefectsExtract()
Dim qcServer As String
qcServer = "http://qc.prod.internal.****.co.uk:8080/qcbin"
Dim QCConnection
Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx qcServer
QCConnection.Login "username", "password"
QCConnection.Connect "Domain", "Project"
Dim Bug, Row
Dim i As Integer
Dim k As Integer
' Get a list of all the defects.
Dim BugFactory, BugList, bugfilter
Set BugFactory = QCConnection.BugFactory
Set bugfilter = BugFactory.Filter
bugfilter.Filter("BG_USER_03") = "Web" ' Filter the defects based on the stream value
bugfilter.Filter("BG_DETECTION_DATE") = ">01/03/2010"
Set bglist = bugfilter.NewList
ActiveSheet.Range("A1:O3000").ClearContents
Row = 1
Sheet2.Cells(Row, 1) = "Total No. of Defect with Status : " & bglist.Count
Row = 2
' Heading for the Columns
Sheet2.Cells(Row, 1).Value = "Defect_ID"
Sheet2.Cells(Row, 2).Value = "Defect Summary"
Sheet2.Cells(Row, 3).Value = "DetectedBy"
Sheet2.Cells(Row, 4).Value = "Priority"
Sheet2.Cells(Row, 5).Value = "Status"
Sheet2.Cells(Row, 6).Value = "AssignedTo"
Sheet2.Cells(Row, 7).Value = "Stream"
For Each Bug In bglist ' Save a specified set of fields.
'For j = 0 To bglist.Count
Row = Row + 1
Sheet2.Cells(Row, 1).Value = Bug.Field("BG_BUG_ID")
Sheet2.Cells(Row, 2).Value = Bug.Summary
Sheet2.Cells(Row, 3).Value = Bug.DetectedBy
Sheet2.Cells(Row, 4).Value = Bug.Priority
Sheet2.Cells(Row, 5).Value = Bug.Status
Sheet2.Cells(Row, 6).Value = Bug.AssignedTo
Sheet2.Cells(Row, 7).Value = Bug.Field("BG_USER_03")
'Next j
Next
End Sub
QC - URL
QC - Username and password
QC - Domain and project for which you need defects
You can filter defcts by proding search criteria
To this Excel macro click on ExtractDefects button.
----------------------------------------------------------------------------------------------------------------------------
Sub DefectsExtract()
Dim qcServer As String
qcServer = "http://qc.prod.internal.****.co.uk:8080/qcbin"
Dim QCConnection
Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx qcServer
QCConnection.Login "username", "password"
QCConnection.Connect "Domain", "Project"
Dim Bug, Row
Dim i As Integer
Dim k As Integer
' Get a list of all the defects.
Dim BugFactory, BugList, bugfilter
Set BugFactory = QCConnection.BugFactory
Set bugfilter = BugFactory.Filter
bugfilter.Filter("BG_USER_03") = "Web" ' Filter the defects based on the stream value
bugfilter.Filter("BG_DETECTION_DATE") = ">01/03/2010"
Set bglist = bugfilter.NewList
ActiveSheet.Range("A1:O3000").ClearContents
Row = 1
Sheet2.Cells(Row, 1) = "Total No. of Defect with Status : " & bglist.Count
Row = 2
' Heading for the Columns
Sheet2.Cells(Row, 1).Value = "Defect_ID"
Sheet2.Cells(Row, 2).Value = "Defect Summary"
Sheet2.Cells(Row, 3).Value = "DetectedBy"
Sheet2.Cells(Row, 4).Value = "Priority"
Sheet2.Cells(Row, 5).Value = "Status"
Sheet2.Cells(Row, 6).Value = "AssignedTo"
Sheet2.Cells(Row, 7).Value = "Stream"
For Each Bug In bglist ' Save a specified set of fields.
'For j = 0 To bglist.Count
Row = Row + 1
Sheet2.Cells(Row, 1).Value = Bug.Field("BG_BUG_ID")
Sheet2.Cells(Row, 2).Value = Bug.Summary
Sheet2.Cells(Row, 3).Value = Bug.DetectedBy
Sheet2.Cells(Row, 4).Value = Bug.Priority
Sheet2.Cells(Row, 5).Value = Bug.Status
Sheet2.Cells(Row, 6).Value = Bug.AssignedTo
Sheet2.Cells(Row, 7).Value = Bug.Field("BG_USER_03")
'Next j
Next
End Sub
No comments:
Post a Comment