Test case status change in test lab using Excel macros (689 Views)
Reply
Occasional Advisor
panki
Posts: 12
Registered: ‎01-07-2014
Message 1 of 5 (689 Views)

Test case status change in test lab using Excel macros

Hi All,

 

I am trying to write the VBA code in Excel to change the test case status in test lab. I am connected to ALM using below code

 

Dim QCConnection


Set QCConnection = CreateObject("TDApiOle80.TDConnection")

Dim sUserName, sPassword
sUserName = "User name"
sPassword = "password"

QCConnection.InitConnectionEx "ALM link"
QCConnection.Login sUserName, sPassword

If (QCConnection.LoggedIn <> True) Then
MsgBox "QC User Authentication Failed"
WScript.Quit
End If

Dim sDomain, sProject
sDomain = "Domain"
sProject = "Project"

QCConnection.Connect sDomain, sProject

If (QCConnection.Connected <> True) Then
MsgBox "QC Project Failed to Connect to " & sProject
WScript.Quit
End If

 

1.Can anybody suggest me how should i proceed or can share the code to change the status using macros?

2.When i am running the above code connection is made successfully but ALM is not opened , so is it correct?

Please use plain text.
Honored Contributor
Trudy Claspill
Posts: 3,558
Registered: ‎09-09-2010
Message 2 of 5 (647 Views)

Re: Test case status change in test lab using Excel macros

Regarding question 2 - yes, this is correct. Using the API to connect to ALM does NOT open the UI.

Regarding question 1 - you need to find the test case that you want to update. What info do you have to identify the test case? You said you want to update the status in the Test Lab. Do you have the ID of the Test Instance? The name/ID of the Test Set that contains the Test Instance?

What info you have to identify the Test Instance dictates the methods you need to use ultimately to access it through the API and subsequently update it. It may help you to look at the API object that represents a Test Instance - namely the TSTest object. The API documentation provides lots of sample code for doing a variety of tasks. If you look at the API documentation, that might give you pointers.
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Please use plain text.
Occasional Advisor
panki
Posts: 12
Registered: ‎01-07-2014
Message 3 of 5 (642 Views)

Re: Test case status change in test lab using Excel macros

Hi,

 

Thanks for your reply...

Basically i want to Change the test case status from failed to not completed.

I want to do it using test instance id for multiple test case. Please suggest.

Please use plain text.
Occasional Advisor
panki
Posts: 12
Registered: ‎01-07-2014
Message 4 of 5 (641 Views)

Re: Test case status change in test lab using Excel macros

Update to my previous reply--

I have the test set id or test set name too...

Please use plain text.
Honored Contributor
Trudy Claspill
Posts: 3,558
Registered: ‎09-09-2010
Message 5 of 5 (628 Views)

Re: Test case status change in test lab using Excel macros

There are a couple of ways you can do this. Here is one.

Start by getting a TestSetFactory object. Use its NewList method with a Filter to get a list of the Test Sets you've identified as having the test instances you want to update. Each item in the list will be a TestSet object.

From each respective TestSet in the list, get a TSTestFactory object. Use the NewList method of that object with a Filter to get a list of the Test Instances that you want to update in the individual Test Sets. That list will contain TSTest objects.

In the TSTest object you can update the Status field to the value you want. After setting the Status property, use the Post method of the object to commit the changes to the database.

There are lots of examples in the API documentation of using the NewList method with a Filter for various objects, though not an example specifically for TestSet and TSTest objects. Look at some of the other objects for examples of this. Try working out the code, them come back to us if you have specific questions.
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation