Search code examples
vbaexcelhp-quality-center

add Test to HP QC From Excel With VBA


i need to import test from excel to hp qc test this is my:

 Set TestFactory = QCconn.TestFactory
Set testObj = TestFactory.AddItem(Null)



testObj.Field("TS_USER_14") = "1" 'Arml
testObj.Field("TS_USER_01") = "TDB" 'Module
testObj.Field("TS_USER_13") = "3" 'Policy Status
testObj.Field("TS_USER_15") = "4" 'Project
testObj.Field("TS_SUBJECT") = "אוטומציה" 'Subject
testObj.Field("TS_NAME") = "ניסיון1" 'Test Name
testObj.Field("ST_DESCRIPTION") = "2"
testObj.Field("TS_RESPONSIBLE") = "zvikav" 'Designer
testObj.Field("TS_USER_12") = "6" 'Policy Type
testObj.Field("TS_USER_11") = "עדיף" ' Product154981
testObj.DesignStepFactory.Fields("DS_STEP_NAME") = "ניסיון"
testObj.Post

i can to upload the test but i cant do a test step

how i upload the DesignSteps?


Solution

  • You need to add a new item after getting the DesignStepFactory:

    ' Get the DesignStepFactory from the test.
    Set DSFactory = testObj.DesignStepFactory
    
    ' Create the new design step.
    Set desstep = DSFactory.AddItem(Null)
    
    ' Set step properties and post step
    desstep.StepName = "Step one"
    desstep.StepDescription = "Do something"
    desstep.StepExpectedResult = "Expect something"
    desstep.Post
    

    Not sure whether it is important to first post your test object before adding the step. But I'm sure you'll find out.