How to log a Bug in ALM using OTA? – User friendly Tech help

Requirement: – Logging Bug in ALM/QC programmatically, without any manual intervention.

n

Solution: – We will utilize the capabilities of OTA (Open Test Architecture) of ALM to log a Bug.

n

Approach: – Key is “TDConnection object” which is the entry point for using OTA; with this object we can access most of the functionalities of QC/ALM.

n

Step1:-

n

Connect to the project, Like we use to connect to ALM manually, we will follow the same steps but this time we will be using OTA .For this we need the Login Name, Password, Domain and Project details and the TDConnection object.

n

n

n

n

n

n

n

n

ALM Login window

n

Step2:-

n

Create BugFactory object to Log a new Bug. Fill all the Bug data as we use to fill it manually.

n

Note: – Pass the entire compulsory field to log a Bug; otherwise it will generate an error.

n

n

n

n

n

n

n

n

New Bug Window

n

'Function call to log the Bug
fn_LogBug("TestUser","TestPwd","UFT","Help")
'**********************************************************************************************
'Function Name:- fn_LogBug
'Function Description:- Logging Bug in ALM using OTA
'Input Parameters:- UserName,Password,Domain,Project( ALM)
'Output Parameters:- None
'Created By :- uftHelp Team
'***********************************************************************************************Public Function fn_LogBug(sUName,sPwd,sDomain,sProject) Dim QCconn Dim BugFact,NewBug
Set QCconn = CreateObject("TDApiOle80.TDConnection")
'Intilizing the QC connection
QCconn.InitConnectionEx "https://alm.com/qcbin"
'Verifying User is connected If QCconn.Connected Then
Print "User Connected to ALM Server" Else
Print "User is not Connected to ALM Server" Exit Function End If
'Filling the UserName and Password for ALM QCconn.Login sUName,sPwd
'Verifying User is Logged into ALM If QCconn.LoggedIn Then
Print "User is Logged into ALM Server" Else
Print "User is not Logged into ALM Server" Exit Function End If
'Connects user to specified Domain and Project QCconn.Connect sDomain,sProject
'Using BugFactory object to log a defect Set BugFact = QCconn.BugFactory Set NewBug = BugFact.AddItem(Null) On Error Resume Next
'Adding the Bug data With NewBug
.Summary = "Issue in the Application"
.DetectedBy = "TestUser1"
.Field("BG_DETECTION_DATE") = Date
.Status = "New"
.Field("BG_DESCRIPTION") = "Testing"
.Field("BG_DEV_COMMENTS") = "Ignore it is Test Bug"
.Field("BG_PRIORITY") = "2-Medium"
.AssignedTo = "TestUser2"
.Field("BG_SEVERITY") = "3-High"
.Field("BG_USER_02") = "Cycle 1"
.Field("BG_USER_03") = "Enhancement" End With
'Adding the Bug to ALM NewBug.Post
If Err.Number "0" Then
Print "Error in logging the Bug = "&Err.Description Else
Print "Successfully Logged the Bug" End If
'Destroying the objects Set NewBug = Nothing Set BugFact = Nothing Set QCconn = NothingEnd Function
Was this article helpful?
YesNo

Similar Posts