0

Does anyone has the below query (get the list of all defects which has attachment and its attachment size) already with them for a particular Quality Centre project?

Query Output: Bug ID || Attachment Size (Collective size of all attachments of this bug)

Update: I was able to write the below QTP Script/VBScript code to achieve this. The below code works. I have to write the response here, since I could not write it in comment section due to character limit restriction. Also, I could not find an option to post an answer to my own question.

Dim  logFileName
logFileName = "C:\TRS Files\Attachments.csv"

Set qcConnection = QCUtil.QCConnection
Set bugFactory=qcConnection.BugFactory
Set bugFilter = bugFactory.Filter

bugFilter.Filter("BG_STATUS")="Closed"
bugFilter.Filter("BG_ATTACHMENT")="Y"

Set bugList = bugFilter.NewList

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(logFileName)
Call objFile.WriteLine("BUG ID" & "," & "Collective Attachment Size")

For Each bug In bugList
            Set bugAttachments = bug.Attachments
            Set bugAttachmentList = bugAttachments.NewList("")
            Dim collectiveAttachmentSize
            collectiveAttachmentSize=0
            For Each bugAttachment in bugAttachmentList
                            collectiveAttachmentSize=collectiveAttachmentSize + bugAttachment.FileSize
            Next
            Call objFile.WriteLine(bug.ID & "," & collectiveAttachmentSize)
            Set bugAttachmentList=Nothing
            Set bugAttachments=Nothing
Next

Set objFile=Nothing
Set objFSO=Nothing
Set bugFilter=Nothing
Set bugFactory=Nothing
Set qcConnection=Nothing
MansoorShaikh
  • 913
  • 1
  • 6
  • 19

0 Answers0