You might have come across situations where you need to bulk update test cases data, below is the coded for doing same based on test name, you can do same based on test id too. I have mentioned the test id parameter in code too in case you want to try id based updates.
Sub UpdateTestPlan()
'=========================================
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://<XXXX>.us.<XXXX>.com/qcbin"
qcID = Sheet1.Cells(2, 1)
qcPWD = Sheet1.Cells(2, 2)
tdc.Login qcID, qcPWD
tdc.Connect "<XXXX>", "<XXXX>"
'=========================================
On Error GoTo err
uR = Sheet2.UsedRange.Rows.Count
Set TestList = tdc.TestFactory
Set TestPlanFilter = TestList.Filter
k = 2
For eR = 2 To uR
k = eR
testPlanID = Sheet2.Cells(eR, 2)
If IsEmpty(testPlanID) Then
Else
TestPlanFilter.Filter("TS_TEST_ID") = testPlanID
Set TestPlanList = TestList.NewList(TestPlanFilter.Text)
Set myTestPlan = TestPlanList.Item(1)
MsgBox myTestPlan.Field("TS_STATUS")
MsgBox myTestPlan.Field("TS_NAME")
MsgBox myTestPlan.Field("TS_SUBJECT")
myTestPlan.Field("TS_STATUS") = Sheet2.Cells(eR, 3)
myTestPlan.Post
Sheet2.Cells(eR, 1) = "Successfull"
End If
Next
'Set TestPlanFilter = Nothing
'Set myTestPlan = Nothing
'Set TestList = Nothing
'Set TestPlanFilter = Nothing
err:
tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection
Application.StatusBar = err.Description
Sheet2.Cells(k, 1) = err.Description
ActiveWorkbook.Save
End Sub
No comments:
Post a Comment