It is used to enable inter-process communication and dynamic object creation in any programming language that supports the technology.
COM Automation allows users to build scripts in their applications to perform repetitive tasks or control one application from another.
The family of COM technologies includes
– COM+
– Distributed COM (DCOM) and
– ActiveX® Controls.
Quality Center Open Test Architecture API -OTA COM 9.0
The Quality Center Open Test Architecture API is a COM library that enables you to integrate external applications with Quality Center. It is naturally and easily used with Microsoft Visual Basic, and the syntax and examples in this reference use Visual Basic. The examples in this project were developed with Microsoft Visual Basic 6.0 and are not necessarily valid under other development platforms.
The OTAClient.dll (OTA COM 9.0 Type Library) is downloaded to the following folder:
Quality Center Object Model
Component Object Model (COM) – Overview
Function to Connect to QC using the OTA API Methods
Private Function makeConnection(ByVal qcHostName$, qcDomain$, qcProject$, qcUser$, qcPassword$, Optional qcPort) As Boolean
'------------------------------------------------------------------------
' This routine makes the connection to the gobal TDConnection object,
' declared at the project level as Global tdc as TDConnection,
' and connects the user to the specified project.
'-----------------------------------------------------------------------
Dim qcServer As String
Const fName = "makeConnection" 'For error message
On Error GoTo makeConnectionErr
errmsg = ""
'Construct server argument of format "http://server:port/qcbin"
qcServer = "http://" & qcHostName
If Not (IsMissing(qcPort)) Then
If Len(qcPort) > 0 Then qcServer = qcServer & ":" & qcPort
End If
qcServer = qcServer & "/qcbin"
''Check status (For illustrative purposes.)
' 'MsgBox tdc.LoggedIn 'Error: OTA Server is not connected
' MsgBox tdc.Connected 'False
' MsgBox tdc.ServerName 'Blank string
'Create the connection
errmsg = "Failed to create TDConnection"
If (tdc Is Nothing) Then Set tdc = New TDConnection
If (tdc Is Nothing) Then GoTo makeConnectionErr
errmsg = ""
tdc.InitConnectionEx qcServer
''Check status.
' MsgBox tdc.LoggedIn 'False
' MsgBox tdc.Connected 'True
' MsgBox tdc.ServerName 'http://
'Log on to server
tdc.Login qcUser, qcPassword
''Check status.
' MsgBox tdc.LoggedIn 'True
' MsgBox tdc.ProjectName 'Empty String
' MsgBox tdc.ProjectConnected 'False
' Connect to the project and user
tdc.Connect qcDomain, qcProject
' MsgBox tdc.ProjectName 'qcProject
' MsgBox tdc.ProjectConnected 'True
' Exit status
makeConnection = SUCCESS
Exit Function
makeConnectionErr:
ErrHandler err, fName, err.Description & vbCrLf & errmsg
makeConnection = FAILURE
End Function
Using the Quality Center Open Test Architecture API methods and classes one can automate and customize the actions of Quality Center like Execute TestSets, Execute Tests, Get Execution Status, Get or Set Requirements, Get or Set Test Design Steps or Attachments and many more actions in Quality Center.
API References:
· Mercury Quality Center Open Test Architecture API Reference
· Mercury Quality Center Site Administration API Reference
Note: Right-Click on the File and Click "Unblock"
NOTE:
If you want to know what is the reference for the TDAPIOLE you have to go to the regedit, "HKEY_CLASSES_ROOT\TDApiOle.TDConnection\CurrVer" and see what is the current version and use it.
NOTE:
If you want to know what is the reference for the TDAPIOLE you have to go to the regedit, "HKEY_CLASSES_ROOT\TDApiOle.TDConnection\CurrVer" and see what is the current version and use it.
8 comments:
i was just looking out for it. Thannks for the help file Sunny.
^^ same as siva, thx for help files !!
Can you please provide the steps on how to use this code in Visual Basic.
I created an empty test but it's not working.
I am using QC 10 with Patch 10.
Thanks
You can try this for starters ...
copy this and paste it in a notepad. Change the QC url, Domain,Project,Username,Password and 'Save As' .vbs file and double click to execute...
-------------------
Dim tdc ,Dmn
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://qc_server:8080/qcbin"
tdc.Login "user123", "password"
tdc.Connect "DOMAIN_NAME","Project_Name"
If tdc.LoggedIn = "True" Then
MsgBox "Connection Successfull", 64, "Quality Center"
End If
tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection
Msgbox "Done!"
Hi Sunny,
I know this is a couple of years old now, but I'm having a problem with creating and updating defects in VBSCript. I'm using HP QC 10, and am synchronising defects between HPQC and TFS. The add-on that's available does most of the things I need, but doesn't do everything, namely update AssignedTo values.
I've had a look around, and everything talks about using the TDHelper object. I'm not sure how I do this, where I get the assembly from, or check that I have it. WHen in VBSCript, I attempt CreateObject("TDHelper") but get an error: "ActiveX component can't create object: 'TDHelper'"
I've posted on HP knowledge board, but hear nothing from them or support. Any help much appreciated.
Thanks
J Singh Padda
Hi Jag,
The above code and the dll files are still same for QC 10. I have checked if the above code work with QC 10, It works fine.
The TDHelper Object, I am not sure of that.
When you open QC, the OTA API gets registered in that machine, therefore you can then start using it in VBScript or any other language.
Once you can connect to QC, you can use traverse to the TestLab section and change stuff like AssignedTo etc..
Hi sunny,
can you please give me links to practice more on this.help me to learn more like this
Post a Comment