jeudi 19 novembre 2015

Excel VBA code to add design steps to the bewly posted test case in Test Plan using OTA

Design steps are getting added to the first test case posted, I need to add design steps to the newly created test cases one by one

Following is my code:

Set td = CreateObject("TDApiOle80.TDConnection")
 'login and connect to the domain

 Set tstMgr = td.TreeManager
Set newFolder = tstMgr.NodebyPath("test case folder")
newFolder.Post

' now create a test case
Set sampleTest = newFolder.TestFactory.AddItem(Null)

' set reqd values
sampleTest.Field("TS_NAME") = 'Test Case Name
sampleTest.Field("TS_TYPE") = 'Type(Manual/Automation)
sampleTest.Field("TS_USER_01") ='Test Case ID
sampleTest.Field("TS_USER_07") ='Test Phase
sampleTest.Field("TS_USER_02") =' Risk Level
sampleTest.Field("TS_USER_03") =' Prepared By
sampleTest.Field("TS_USER_04") ='Test Type
sampleTest.Field("TS_USER_05") ='Country
sampleTest.Field("TS_USER_06") ='Application
testID = sampleTest.Field("TS_TEST_ID")  'get the test ID
sampleTest.Post

 ' create test steps
Set myTestFilter = newFolder.TestFactory.Filter
Set TestF = newFolder.TestFactory
TestF.Filter("TS_TEST_ID") = testID
 Set myTestList = TestF.NewList(myTestFilter.Text)
 Set getTest = myTestList.Item(1)
 Set DSFactory = getTest.DesignStepFactory
 Set desstep = DSFactory.AddItem(Null)
 Set stepList = DSFactory.NewList("[empty]")
 Dim filtercond As String
 desstep.Field("DS_STEP_NAME") ='design step name
desstep.Field("DS_DESCRIPTION") ='design step description
desstep.Field("DS_EXPECTED") = ''design step expected result
 desstep.Post
 stepList.Add (desstep)
 stepList.Post
 sampleTest.Post

Request you to kindly help me in this regard.

Aucun commentaire:

Enregistrer un commentaire