Wednesday, July 13, 2016

Update a Test Plan Field in ALM(QC)

 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 Defect and click on your System Folder 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 (TS_STATUS)


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

The following example updates the ‘Test Plan’ that has the ‘Test Set ID’ of 6 and changes the ‘Status’ field to Ready.






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

'Update Status Field
Set TestList = tdc.TestFactory
Set TestPlanFilter = TestList.Filter
Set TestPlanList = TestList.NewList("")
For each tpTest in TestPlanList
 Set myTestPlan = TestPlanList.Item(tpTest.ID)
 myTestPlan.Field("TS_STATUS") = "Ready"
 myTestPlan.Post
Next

Set TestPlanFilter = Nothing
Set myTestPlan = Nothing
Set TestList = Nothing
Set TestPlanFilter = Nothing

No comments:

Post a Comment