Hi everyone! Today I am going to teach you how to upload a defect using OTA API. From my precious posts you can find the process of Connecting to QC ALM Using OTA API. After you have understood the basics of how to connect to QC, you will need to know about the Bug Factory and the parameters of a Bug Object. In case you have missed that, I strongly recommend check out my other post Pulling Defects from QC ALM using OTA API.
Here goes the code :
NewBug.Status = BugStatus
NewBug.Project = BugProject
NewBug.Summary = BugSummary
NewBug.Description = BugDescription
NewBug.DetectionDate= Today()
NewBug.DetectedBy = BugDetectedBy
NewBug.AssignedTo = BugAssignedTo
Else: MsgBox("Failed to Connect to Project!")
End If
Else : MsgBox("Login Failed!")
End If
TDConn.DisconnectProject
TDConn.Logout
TDConn.ReleaseConnection
TDConn = Nothing
End Sub
The reason I used so many string variables for the values of the Bug Object parameters is that you can use user input options. So here you have a brand new code for updating defect in QC. Play around with a bit to learn more!
Thanks for visiting!
So how do we update a defect? Well, for one the defect doesn't exist yet in QC ALM Database. So first we create a Bug using AddItem method and we add a null value. This creates a Bug Object. We use the properties or fields of the Bug Object to specify the parameters of the defect. And then using Post method we simply post the Bug to the QC Database! It's that simple!
Here goes the code :
Sub GetOpenDefects()
Dim msgStr as String
Dim TDConn as TDAPIOLELib.TDConnection
Dim BugStatus As String
Dim msgStr as String
Dim TDConn as TDAPIOLELib.TDConnection
Dim BugStatus As String
Dim BugProject As String
Dim BugSummary As String
Dim BugDescription As String
Dim BugDetectedBy As String
Dim BugAssignedTo As String
Dim BugPriority As String
Dim BugSeverity As String
Set TDConn = CreateObject("TDApiOle80.TDConnection")
TDConn.InitConnectionEx [QCbinpath]
TDConn.Login [UserName], [Password]
If TDConn.LoggedIn Then
TDConn.Connect [Domain], [Project]
If TDConn.Connected
Dim BugFact as TDAPIOLELib.BugFactory
Dim NewBug as TDAPIOLELib.Bug
'Get the BugFactory
Set BugFact = TDConn.BugFactory
'Get the New Bug Object
Set NewBug = BugFact.AddItem("")
'Set the New Bug Object parametersTDConn.InitConnectionEx [QCbinpath]
TDConn.Login [UserName], [Password]
If TDConn.LoggedIn Then
TDConn.Connect [Domain], [Project]
If TDConn.Connected
Dim BugFact as TDAPIOLELib.BugFactory
Dim NewBug as TDAPIOLELib.Bug
'Get the BugFactory
Set BugFact = TDConn.BugFactory
'Get the New Bug Object
Set NewBug = BugFact.AddItem("")
NewBug.Status = BugStatus
NewBug.Project = BugProject
NewBug.Summary = BugSummary
NewBug.Description = BugDescription
NewBug.DetectionDate= Today()
NewBug.DetectedBy = BugDetectedBy
NewBug.AssignedTo = BugAssignedTo
NewBug.Priority = BugPriority
NewBug.Severity = BugSeverity
'In case you have to update a custom field, add a line like this
'NewBug.Field("BG_USER_XX")= "Some value"
'Force the bug to update in QC
NewBug.Post()
MsgBox("Bug is Updated!")Else: MsgBox("Failed to Connect to Project!")
End If
Else : MsgBox("Login Failed!")
End If
TDConn.DisconnectProject
TDConn.Logout
TDConn.ReleaseConnection
TDConn = Nothing
End Sub
The reason I used so many string variables for the values of the Bug Object parameters is that you can use user input options. So here you have a brand new code for updating defect in QC. Play around with a bit to learn more!
Thanks for visiting!
I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious...
ReplyDeletevba course london
Thanks for sharing a such a knowledgable post with us. Excelllent knowledge deleiverd to us.
ReplyDeletevba course in delhi
vba course in Gurgaon
vba course in Noida
Thanks for sharing such informative post. I am very interested in this topic. and managing prices in such a fashion that high quality and our entry to well being care just isn't adversely affected. Republicans search to realize these identical fundamental and broad objectives, however their method is proposed as being extra market pushed than authorities pushed. Green tea weight loss
ReplyDeleteMerci pour ton partage qui m'a beaucoup éclairé.
ReplyDelete