Micro Focus QTP (UFT) Forums
Manipulate a manual run from QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Manipulate a manual run from QTP (/Thread-Manipulate-a-manual-run-from-QTP)



Manipulate a manual run from QTP - hammersandnails - 05-22-2012

For performance and ease of maintenance I am trying to move away from executing test from Quality Center. I would still like to have results stored there.

1. I need to create a test case in QC - Done
2. create a test set
3. create instance of manual test in new test set
4. create a run, set the status of the steps (pass fail)
5. attach results.

I cant figure out how to do step 4.

I'm including I found that works for step 1 in case it helps anyone else.
Code:
Dim td 'As TDConnection
Dim DesignStpFactory 'As DesignStepFactory
Dim TestFactory 'As TestFactory
Dim Testobj 'As Test
Dim DesignStp 'As DesignStep
Dim TreeMgr 'As TreeManager

Set td = QCUtil.TDConnection
Set TestFactory = td.TestFactory

Set TreeMgr = td.TreeManager
Set folder = TreeMgr.NodeByPath("Subject\Development")
Set testFactory = folder.TestFactory
Set Testobj = testFactory.AddItem ("Run004")
Testobj.Post ()

Set DesignStpFactory = Testobj.DesignStepFactory
For i = 1 To 5
    Set DesignStp = DesignStpFactory.AddItem(Null)
    DesignStp.Field("DS_STEP_NAME") = "Step " & i
    DesignStp.Field("DS_DESCRIPTION") = "The design step description"
    DesignStp.Field("DS_EXPECTED") = "The expected"
    DesignStp.Post
Next

MsgBox "Created Test"


Sub Failure1

    Dim td 'As TDConnection
    Dim dsf 'As DesignStepFactory
    Dim tf 'As TestFactory
    Dim t 'As Test
    Dim ds 'As DesignStep
    Set td = QCUtil.TDConnection
    Set tf = td.TestFactory
    t = tf.AddItem("New Manual test")
    t.Post
    Set dsf = t.DesignStepFactory
    For i = 1 To 5
    Set ds = dsf.AddItem(Null)
    ds.Field("DS_STEP_NAME") = "Step " & i
    ds.Field("DS_DESCRIPTION") = "The design step description"
    ds.Field("DS_EXPECTED") = "The expected"
    ds.Post
    Next

end sub