Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Need to retrieve Test Details from QC using OTA API

Hi All,


I need to retrieve the list of field names (Details tab of a test case) associated with test case from Test lab.Both System fields and User defined fields needs to retrieved. Not only just field names, its default values and if its, list, then the list values.


The purpose of this is to automate the creation of excel template to write test cases. The resulted excel template should contain the column header as field names with data filter if applicable. How to do that using OTA API?


For example, i need to get the details such as test name, complexity, business criticality, Test Id labels.


Thanks in advance,


2 Replies
Fleet Admiral
Fleet Admiral



to retrieve the list of TEST fields from a vbscript you can do like this:


Const usr = "qcadmin"

Const psw = "qcpassword"

Const Dominio = "MY_DOMAIN"

Const Project = "MyProject"

Dim tdc

set tdc = CreateObject("tdapiole80.tdconnection.1")


'connect to a project

tdc.InitConnectionEx http://qualitycenteraddress/qcbin  
tdc.login usr, psw
tdc.Connect Dominio, Project


set TestFieldList = tdc.Fields("TEST")


'Now TestFieldList is a the List that contain all the fields of the TEST table.


'this part come from OTA example 

For Each aField In TestFieldList

        With aField


' Get the FieldProperty object

        Set FieldProp = aField.Property

        If True Then 'fieldProp.IsActive Then

            Debug.Print "---------------------------"

            Debug.Print "TDField.Name: " & .Name

            'TDField.Name: AT_ENTITY_TYPE

            Debug.Print vbTab & "FieldProperty.DBColumnName: " _
                & FieldProp.DBColumnName

            ' FieldProperty.DBColumnName: AT_ENTITY_TYPE

            Debug.Print vbTab & "TDField.Property: " & .Property

            ' FieldProperty.UserLabel: Entity

            Debug.Print vbTab & "FieldProperty.UserLabel: " _
                & FieldProp.UserLabel

            ' FieldProperty.UserLabel: Entity

            Debug.Print vbTab & "TDField.Type: " & .Type _
                & " = " & DataTypeString(.Type)

            ' TDField.Type: 3 = TDOLE_STRING

            Debug.Print vbTab & "FieldProperty.DBColumnType: " _
                & FieldProp.DBColumnType

            ' FieldProperty.DBColumnType: char

            Debug.Print vbTab & "FieldProperty.UserColumnType: " _
                & FieldProp.UserColumnType

            ' FieldProperty.UserColumnType: char

            If FieldProp.IsKey Then

                  Debug.Print vbTab _
                    & "Key Field - FieldProperty.KeyOrder: " _
                    & FieldProp.KeyOrder

                  ' Key Field - FieldProperty.KeyOrder: 0

            End If

            Debug.Print vbTab & "This field" _
                & IIf(FieldProp.IsActive, " is ", " is not ") _
                & "visible in the UI"

            ' This field is not visible in the UI

        End If

        End With





Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Massimo, Excellent and Thanks. But, i have few queries, below,

1. Is the function, DataTypeString() is inbuilt or userdefined? Coz, its not available for me,

2. If a field is List Type, then how can i get the values in the list?


Appreciating your help on this.


- Bhuvanesh

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.