Showing posts with label QTP with QC. Show all posts
Showing posts with label QTP with QC. Show all posts

Monday, May 3, 2010

Connecting and disconnectingto QC through API

The following function helps to connect QC

public function connectToQC(qcUserName, qcPwd, qcURL, qcDomain, qcProject)
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx qcURL
tdc.Login qcUsername, qcPwd
tdc.Connect qcDomain, qcProject
if tdc.connected then
connectToQC = 0
else
connectToQC = 1
end if
set tdc = nothing
end function

The following function helps to disconnect from QC

public function disconnectQC()
Set tdc = CreateObject("TDApiOle80.TDConnection")
If tdc.Connected Then
tdc.Disconnect
End If
If tdc.LoggedIn Then
tdc.Logout
End If
set tdc = nothing
end function