Get a list of links from a Test Set

Public Sub TestSetLinks()

' Get a list of links from a Test Set

    Dim TSetFact As TestSetFactory
    Dim tsFact As TSTestFactory
    Dim aTestSet As TestSet
    Dim tsSets As List, Links As List
' Get the list of test sets from the test set factory.
    'tdc is the global TDConnection object.
    Set TSetFact = tdc.TestSetFactory
    Set tsSets = TSetFact.NewList("")
' Get any test set (for demonstration purposes).
    Set aTestSet = tsSets.Item(1)
    Debug.Print aTestSet.ID, aTestSet.Name
' To get the BugLinkFactory,
' cast the test set variable to an ILinkable
' reference. Note that implemented interfaces are
' not directly accessible, so this won't work:
'   Set LinkF = TestSet.BugLinkFactory
    Dim linkableTestSet As ILinkable
' The cast:
    Set linkableTestSet = aTestSet
' Get the factory from the iLinkable reference.
    Dim linkF As LinkFactory
    Set linkF = linkableTestSet.BugLinkFactory
' Now use the factory.
' Application code.
    Set Links = linkF.NewList("")
    Debug.Print Links.Count
    ' etc.
End Sub