HP Quality Center – Check if Connection to QC is made successfully ?

.

Hello Friends,
 
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

Buy a coffee for the author

Adsense

Download FREE Tools and Templates

There are many cool and useful excel tools and templates available to download for free. For most of the tools, you get the entire VBA code base too which you can look into it, play around it, and customize according to your need.

Dynamic Arrays and Spill Functions in Excel: A Beginner’s Guide
Dynamic Arrays and Spill Functions in Excel: A Beginner’s Guide

In today's tutorial, we'll be diving into the exciting world of dynamic arrays and spill functions in Office 365 Excel. These features have revolutionized the way we work with data, providing a more flexible and efficient way to handle arrays. I am going to explain...

How to Declare a Public Variable in VBA
How to Declare a Public Variable in VBA

While programming in VBA sometimes you need to declare a Public Variable that can store the value throughout the program. Use of Public Variable: Let's say you have 4 different Functions in your VBA Code or Module and you have a variable that may or may not be...

How to Copy content from Word using VBA

As many of us want to deal with Microsoft Word Document from Excel Macro/VBA. I am going to write few articles about Word from Excel Macro. This is the first article which opens a Word Document and read the whole content of that Word Document and put it in the Active...

What is Excel Formula?

Excel Formula is one of the best feature in Microsoft Excel, which makes Excel a very very rich application. There are so many useful built-in formulas available in Excel, which makes our work easier in Excel. For all the automated work, Excel Macro is not required. There are so many automated things can be done by using simple formulas in Excel. Formulas are simple text (With a Syntax) which is entered in to the Excel Worksheet Cells. So how computer will recognize whether it is a formula or simple text? Answer is simple.. every formula in Excel starts with Equal Sign (=).

You May Also Like…

5 Comments

  1. Jagan Shirsath

    Hi,

    I am getting below error, when i am trying to login with HP QC.

    “QC User Authintication Failed”

    Reply
  2. Rohit

    Hi ,

    I am also “QC User Authentication failed” while trying to log in HP ALM.

    Please reply , how can I get rid of this…

    Thanks in Advance…

    Reply
  3. Dinesh

    “QCConnection” always returns empty and QC user Authentication Failed. 🙁

    Reply
  4. Suresh

    I am getting the below error:
    “QC User Authintication Failed”

    Reply
  5. Matt L

    Try logging into ALM (via Internet Explorer or QC Explorer) and then installing both “HP Quality Center Connectivity” and “HP ALM Client Registration” Add-Ins from the Help Menu.

    Once complete, try the script again.

    Reply

Trackbacks/Pingbacks

  1. HP Quality Center - Connect to HP QC using Excel VBA - Let's excel in Excel - […] HP Quality Center – Create Folder Structure in Test Lab and Pull test Cases from Test Plan HP Quality…

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Join and get a FREE! e-Book

Don't miss any articles, tools, tips and tricks, I publish here

You have Successfully Subscribed!

Pin It on Pinterest