ALM/QC – How to Update a Test Set using OTA

ALM/QC – How to Update a Test Set using OTA

Code Hacker

Is it possible to use OTA to update a Test Set in ALM/QC?

Since writing my post “How to Update a Defect using OTA” I’ve received a few emails over the past several months inquiring if it’s possible to also update information for an ALM Test Lab Test Set using HP’s Open Test Architecture (OTA).

The quick answer is “Yes” but rather than answer each one individual, I thought it would be better to frame my replay in the form of a quick post.

How to get the QC/ALM field name

In order to update a field in ALM using OTA you will need to know the backend name that ALM assigns to the field. This name is normally different than the label name that you might see in the ALM Test Lab section.

If you don’t know what the actual field names are, you can easily find them by going into QC’s Tools>Customize.

In the Project Customization section and go into the “Project Entities” section.

Under the Project Entities Tree view click expand ‘Test Set’ and click on ‘System Fields’ or ‘User Fields’. Clicking on a field will reveal the field name that you will need to use.

For this example I want to find the System Field > Status and get the name value for it (CY_STATUS)

QTP OTA Code to Update a Test Set Field in an ALM/QC Test Lab

The following example updates the ‘Test Set’ that has the ‘Test Set ID’ of 1 and changes the ‘Status’ field to Closed.

The code is pretty straight forward and uses the OTA’s TestSetFactory object to accomplish our goal.

  • Creating an instance of the TestSetFactory object allows us to access all the services needed to manage test sets.
  • Next you set the Filter property to set the ID for the test set that you want to update.
  • Finally use the TestSetFactory’s NewList method to create a list of object that match your specified filter.
  • Make sure to use the Post method to actually write the changed values to your ALM database


set tdc = createobject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://yourURL/qcbin"
tdc.Login "yourName","yourPassword"
tdc.Connect "yourDomain","yourProject"

testSetID = 1
Set TSetFact = tdc.TestSetFactory
Set TestSetFilter = TSetFact.Filter
TestSetFilter.Filter("CY_CYCLE_ID") = testSetID

Set TestSetList = TestSetFilter.NewList
Set myTestSet = TestSetList.Item(1)
myTestSet.Field("CY_STATUS") = "Closed"

Set TestSetFilter = Nothing
Set myTestSet = Nothing
Set TSetFact = Nothing
Set TestSetFilter = Nothing

To run the defect code you can either place it in QTP and run as a script or place the code in a text file and save as a .VBS vbscript file.

Good Luck!

Anand Saboo - May 7, 2013

How to fetch the linked defect ID from Test lab through OTA?

Pamela - November 29, 2013

Joe – thanks for the info!! But, I want to go the other way…I want to retrieve a value from the Execution Grid, say “Test Server”, and use it within the QTP script…and I cant seem to find any info on how to do this, can you help? I made a custom field in the Project Entities Test Instance area, internally called TC_USER_01 but don’t know how to access its value in QTP –


    Joe Colantonio - December 11, 2013

    Hi Pamela – I’d have to try it but you might be able to get ti it using the OTA TsTestFactory object. I’ll try it tomorrow and let you know what I find

Jojo - January 14, 2014

Hi Joe. Thanks for the information. Unfortunately I am getting “Failed to post” error. Why is this happening? Can you help? Thanks a lot!

    Joe Colantonio - January 17, 2014

    Not sure – it might be a user rights issue

Amrita - April 11, 2014

Hi Joe,

Thanks for sharing the info, it is really helpful.
How can we upload the reports into QC using OTA with VB script and also access these reports later when needed.

angel Barrientos - July 14, 2014


How do I update Run fields using OTA? filter by test set and Run ID?


Robin - August 1, 2014

Hi Joe,
Have you ever tried using OTA to generate a report from the Dashboard module – Analysis View? I’ve searched by do not see anything in the OTA directory in ALM that I could use to click on a document in that particular tree structure.

    Joe Colantonio - August 2, 2014

    Sorry I have not tried this. Does anyone else have a solution for Robin?

      Yisroel Orenbuch - November 25, 2014

      I researched this topic [automating the execution of Excel Reports from the Dashboard – I was very good at writing Excel Reports, but I didn’t want to have rewrite them to be able to run them from outside of QC/ALM… It was not something that was supported, so it probably [but not 100% sure] doesn’t pay to look into it further.

Vijayakumar - October 14, 2016

I want to update a particular test status as Pass or fail in test lab by passing the test path. Need to find a test in the path and update the status.

Please help

Click here to add a comment

Leave a comment: