Adding Defects to Quality Center

Connects to ALM from a test and adds a bug to the database. A similar example can be found in the AddDefectToQC.vbs file located in the <Installdir>\CodeSamplesPlus folder.

Dim TDConnection
Set TDConnection = CreateObject("TDApiOle80.TDConnection")
 
TDConnection.InitConnection "http://myALMServer:8080/qcbin" ' URL for ALM
TDConnection.Login "<ALMUser>", "<ALMPassword>" ' Log on to server
TDConnection.Connect "<ALMDomain>", "<ALMProject>" ' Connect to the domain and project

If TDConnection.Connected Then
	MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName _
	+ chr (13) +"Project " + TDConnection.ProjectName )
Else
	MsgBox("Not Connected")
End If
 
'Get the IBugFactory
Set BugFactory = TDConnection.BugFactory
 
'Add a new empty bug
Set Bug = BugFactory.AddItem (Null)
 
'fill the bug with relevant parameters
Bug.Status = "New"
Bug.Summary = "Connecting to ALM"
Bug.Priority = "4-Very High" ' depends on the ALM settings
Bug.AssignedTo = "<ALMUser>" ' user that must exist in the ALM's users list
Bug.DetectedBy = "<ALMUser>" ' user that must exist in the ALM's users list
Bug.Field("BG_DETECTION_DATE") = FormatDateTime(Now, 2)
Bug.Field("BG_SEVERITY") = "4-Very High" ' depends on the ALM settings

'Post the bug to ALM ( commit )
Bug.Post