Monday, February 13, 2012

Attach resource to Current run of QC

Once we integrate QTP with QC, we need to upload the resources to current run of QC. Here is the code to attach the resources to current run.
-------Code----------
Dim CurrentRun, attachment

On error resume next
If QCUtil.IsConnected Then
Set CurrentRun =QCUtil.CurrentRun
Set attachment = CurrentRun.Attachments
If Err.Number = 424 Then
Reporter.ReportEvent micWarning, "Not running through QC so can't save results", ""
Else
Reporter.ReportEvent micDone, "Attachment Saved to QC curent run", strFileName
Set Attlist = attachment.NewList("")
Set Att = attachment.AddItem(Null)
att.FileName = strFileName
att.Type = 1
att.Post
att.Save False
End If
Else

Reporter.ReportEvent micWarning, "No connection", "Not connected to Quality Center"

End If

On error goto 0

No comments:

Post a Comment