Quality Center -OTA : Create a Test in QC Test Plan
In the previous blog post, we got to know about connecting to Quality Center using vb script /QTP.
Now, we will create a test case in QC Test plan.
Function Create_Test (QC_TestPlan_Path)
Connect_QC( ) ' To check whether QC is connected
Set treeMng = GLOBAL_QC_CONNECTION.TreeManager
Set DestFolder=treeMng.NodeByPath(GLOBAL_QC_TESTPLAN_TREEPATH)
Set TestF=DestFolder.TestFactory
Set objTest = testF.AddItem(Null)
objTest.Field("TS_USER_01")="xxx"
objTest.Field("TS_USER_04")="yyy"
objTest.Field("TS_SUBJECT")=QC_TestPlan_Path ' subject
objTest.Field("TS_USER_14")="cxxx"
objTest.name ="TC_01_XXX"
objTest.type ="QUICKTEST_TEST" 'ttype
objTest.Field("TS_DESCRIPTION")="This is a sample test"
objTest.Post
' By posting the test , a new test will be created
'To update the design steps - we need to check-out the test case and add the details like test 'condition,expected results,step name,execution steps
Set VerCtl = objTest.VCS
VerCtl.CheckOut -1, "To change state", True
Set myTestFilter = TestF.Filter
myTestFilter.Filter("TS_NAME") ="TC_01_XXX"
Set mytestList = TestF.NewList(myTestFilter.Text)
set getTest = myTestList.Item(1)
Set DSFactory = getTest.DesignStepFactory
Set desstep = DSFactory.AddItem(Null)
desstep.Field("DS_USER_02")="xxx"
desstep.Field("DS_EXPECTED")="Expected Result"
desstep.Field("DS_DESCRIPTION")="Description"
desstep.StepName="Step1"'stepname
desstep.Post
'After posting the design step , we will check-in the test case .
VerCtl.CheckIn "", "Changed status"
VerCtl.Refresh
End Function
Hope this blog post helps you !! Appreciate your feedback :)
Comments
Post a Comment