VB script code to change the field of a test case in ALM
Below code helps in updating the data of any field of multiple tests uploaded in ALM without logging into the ALM.
You just need to feed the name of the test cases , folder path and ALM credentials.
I have passed all the data from excel and created a macro in same excel using the below code.
Set td = CreateObject("TDApiOle80.TDConnection")
Dim rng As Range
RowCnt = Sheets("Sheet2").Range("A1").End(xlDown).Row
ALMUrl = Sheets("Sheet1").Range("B1").Value
ALMDomain = Sheets("Sheet1").Range("B2").Value
ALMProject = Sheets("Sheet1").Range("B3").Value
ALMUserId = Sheets("Sheet1").Range("B4").Value
ALMUserPwd = Sheets("Sheet1").Range("B5").Value
RowCnt = Sheets("Sheet2").Range("A1").End(xlDown).Row
'=========================================
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx ALMUrl
tdc.Login ALMUserId, ALMUserPwd
tdc.Connect ALMDomain, ALMProject
'=========================================
Set tstMgr = tdc.TreeManager
'Specify the Folder path in TestPlan, All the scripts under that will be executed.
Set tsttr = tstMgr.NodeByPath(Sheets("Sheet1").Range("B6").Value)
'---------------------------------------------
Set TestList = tsttr.TestFactory
Set TestPlanFilter = TestList.Filter
Set TestPlanList = TestList.NewList("")
For i = 2 To RowCnt
For Each tpTest In TestPlanList
If tpTest.Name = Sheets("Sheet2").Range("A" & i).Value Then
'Below is the example to update the type of the test.
tpTest.Type = "QUICKTEST_TEST"
tpTest.Post
Exit For
End If
Next
Next
tdc.ReleaseConnection
Set TestPlanFilter = Nothing
Set myTestPlan = Nothing
Set TestList = Nothing
Set TestPlanFilter = Nothing
MsgBox "Update is complete"
Comments
Post a Comment