Using QCUtil object we can connect ALM from QTP
QCUtil have below property
1)
CurrentRun Property: Its return QC OTA Run object of current
execution. Indicate Run properties of the Test in the Test Plan Tab.
Example:
Set cRun=qcutil.CurrentRun
strRunName=cRun.Name
2)
CurrentTest Property: Its return QC OTA Test object. Refer to test
in Test Plan tab in ALM.
Example:
dim CurrentTest
set CurrentTest =
QCUtil.CurrentTest
Reporter.ReportEvent
2,"Current Test", CurrentTest.Name
3)
CurrentTestSet Property: Returns the Quality Center OTA TestSet
object. CurrentTestSet present in Test Lab tab in QC.
Example:
set CurrentTSTest = QCUtil.CurrentTestSet
strTestSetName= CurrentTSTest.Name
4)
CurrentTestSetTest Property: Returns the Quality
Center OTA TSTest object, which represents an execution instance. Refer to test
in Test Lab tab.
Example:
Dim CurrentTSTestSet
set CurrentTSTestSet =
QCUtil.CurrentTestSetTest
5)
IsConnected Property: Indicates whether QuickTest is currently connected
to a Quality Center project. It is recommended to insert an IsConnected
step before other Quality Center operations.
Example:
if QCUtil.IsConnected then
Reporter.ReportEvent micPass,”QC Connected”, “QC
Connection already exists”
Else
Reporter.ReportEvent micFail,”QC Connected”, “QC
Connection not available”
EndIf
6)
QCConnection Property: Returns the Quality
Center OTA QCConnection object, which represents the current Quality Center
session and provides access to the Quality Center object model.
Example:
Dim QCConnection
Set QCConnection =
QCUtil.QCConnection
'Get the IBugFactory
Set BugFactory =
QCConnection.BugFactory
'Add a new, empty defect
Set Bug = BugFactory.AddItem
(Nothing)
'Enter values for required fields
Bug.Status = "New"
Bug.Summary = "New
defect"
Bug.DetectedBy = "admin"
' user that must exist in the database's user list
'Post the bug to the database (
commit )
Bug.Post
All above method will work if QTP is already connected with
ALM using Quality Center Connection menu. We can also connect with ALM using
QTP AOM.
Example:
set
objQTPApp=CreateObject("QuickTest.Application")
objQTPApp.Launch
objQTPApp.Visible=True
Set objALMCon=objQTPApp.TDConnection
If not
objALMCon.IsConnected Then
objALMCon.Connect
"serverurl", "domain name", "project
name","username", "password"
End If
No comments:
Post a Comment