hi, I've seen some posts regarding listing steps, but they don't seem to apply...

I have 2 functions - GetComponent and GetSteps
The first one retrieves all components I have, and the second the steps details (or so I thought)...

I have been trying to list the components and parameters within a test and later on the full list of steps for this test - but it has to happen in Design time, most of my test procedures haven't been executed, so I can't get the list from the test set (and here is where I am struggling)

How to get the list of components from a test and how to list its steps from the Test Plan?


Public Sub GetComponent()
Dim td_cmpFact As TDAPIOLELib.ComponentFactory
Dim td_ListCmp As TDAPIOLELib.ComponentFolderFactory
Dim td_folder As TDAPIOLELib.ComponentFolder
Dim td_cmp As TDAPIOLELib.Component
Dim td_parm As TDAPIOLELib.ComponentParam
Dim td_listParm As TDAPIOLELib.ComponentParamFactory
Dim td_List As TDAPIOLELib.List
Dim td_LstCmp As TDAPIOLELib.List
Dim td_lstParm As TDAPIOLELib.List

On Error GoTo ErrorHandler

Set td_ListCmp = td_connection.ComponentFolderFactory

Set td_List = td_ListCmp.NewList("")

For Each td_folder In td_List
Set td_cmpFact = td_folder.ComponentFactory

Set td_LstCmp = td_cmpFact.NewList("")
For Each td_cmp In td_LstCmp
Set td_listParm = td_cmp.ComponentParamFactory
Set td_lstParm = td_listParm.NewList("")

For Each td_parm In td_lstParm
Debug.Print td_parm.Desc
Debug.Print td_parm.Value
Debug.Print td_parm.Order
Next td_parm
Next td_cmp

Next td_folder


End Sub

Public Function GetSteps(ByVal str_test As String) As Long
Dim td_List As TDAPIOLELib.List
Dim td_ListTests As TDAPIOLELib.List
Dim td_subject As TDAPIOLELib.SubjectNode
Dim td_test As TDAPIOLELib.Test
Dim td_stepFactory As TDAPIOLELib.DesignStepFactory
Dim td_listSteps As TDAPIOLELib.List
Dim td_Step As TDAPIOLELib.DesignStep

'get list of folders within given path
Set td_List = td_connection.TreeManager.NodeByPath(str_testPlan) .FindChildren("", False)

'runs through subject tree
For Each td_subject In td_List
Set td_ListTests = td_subject.FindTests("")
For Each td_test In td_ListTests
Debug.Print td_test.Name
Set td_stepFactory = td_test.DesignStepFactory
Set td_listSteps = td_stepFactory.NewList("")
For Each td_Step In td_listSteps
Debug.Print td_Step.StepDescription
Debug.Print td_Step.StepExpectedResult
Next td_Step
Next td_test
Next td_subject

Exit Function
' TreatError Nothing, Err.Number, Err.Description, "Unable to retrieve number of steps for test script: " & str_test
End Function