Adding Defects to Quality Center

January 24, 2009

Here is a sample code to Connects to Quality Center (TestDirector) from a QuickTest test and adds a bug to the database

Dim TDConnection
Set TDConnection = CreateObject("TDApiOle.TDConnection")
TDConnection.InitConnection "http://hpqc/tdbin" ' URL for the DB
TDConnection.ConnectProject "TD76","abc","xyz" ' Valid login information
If TDConnection.Connected Then
MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName _
+ chr (13) +"Project " + TDConnection.ProjectName )
MsgBox("Not Connected")
End If
'Get the IBugFactory
Set BugFactory = TDConnection.BugFactory
'Add a new empty bug
Set Bug = BugFactory.AddItem (Nothing)
'Fill the bug with relevant parameters
Bug.Status = "New"
Bug.Summary = "Connecting to TD"
Bug.Priority = "4-Very High" ' depends on the DB
Bug.AssignedTo = "admin" ' user that must exist in the DB's users list
Bug.DetectedBy = "admin" ' user that must exist in the DB's users list
'Post the bug to database (commit)

This code is taken from
all credit goes to the author.

You Might Also Like


  1. hi, I try to login to QC 9.2 and the connection fail. do you happen to know how to connect to the new version?

  2. Your question or qanswer for some occassion difficult to understand ..pls make it a general one