HP Quality Center – Check if Connection to QC is made successfully ?
This article is basically an extension to my previous article How to Connect to HP QC using Excel VBA. As we know, from the previous article that QC Connection is made in two parts:
1. Authentication using QC ID and Password
2. Login with Domain and Project Name
It is a good practice to check the Connection Object – qcConnection whether Authentication and Login with Domain and Project were successful before using it.
VBA Statement to check if Authentication was Successful ?
If (QCConnection.LoggedIn <> True) Then MsgBox "QC User Authentication Failed" End If
VBA Statement to check if Login with Domain and Project was Successful ?
If (QCConnection.AuthenticationToken = "") Then MsgBox "QC Project Failed to Login with your Domain and Project" QCConnection.Disconnect End If
Refer the below VBA code to connect to QC with both the checks done
Function ConnectToQC() On Error Resume Next Dim QCConnection 'Create QC Connection Object to connect to QC Set QCConnection = CreateObject("TDApiOle80.TDConnection") Dim sUserName, sPassword, sDomain, sProject sUserName = "" sPassword = "" sDomain = "" sProject = "" QCConnection.InitConnectionEx "<you URL>" 'Authenticate your user ID and Password QCConnection.Login sUserName, sPassword 'Quit if QC Authentication fails If (QCConnection.LoggedIn <> True) Then MsgBox "QC User Authentication Failed" End End If 'Login to your Domain and Project QCConnection.Connect sDomain, sProject 'Quit if login fails to specified Domain and Project If (QCConnection.AuthenticationToken = "") Then MsgBox "QC Project Failed to Connect to " & sProject QCConnection.Disconnect End End If
My name is Vishwamitra Mishra. Friends Call me Vishwa. This blog is authored by me. I am an Excel Geek. Well, this blog talks a lot about my passion in Excels & Macros so I’ll not talk about it :) I am very much passionate about traveling & quite recently discovered that I am a good photographer too..:P
AND GET A FREE!
E-BOOK FOR EXCEL VBA BEGINNERS
DON'T MISS ANY NEW ARTICLE !
Get your FREE! E-Book & Have Every New Article Delivered Straight To Your Email-Box