Public Sub AddCoverageEx() ' Add all tests under a subject folder to the requirement coverage ' Get a List of all the covering tests that have not run Dim SubNode As SubjectNode, SubjectID As Variant Dim theReqToCover As Req Dim testFilter As TDFilter On Error GoTo AddCoverageExErr ' For code of GetSubjectNodeByPath, see example ' Getting a test subject node by the node path Set SubNode = GetSubjectNodeByPath("Flight Reservation") SubjectID = SubNode.NodeID Debug.Print SubjectID ' Get the requirement to cover: "Car Rentals" ' under "Products/Services On Sale" ' To see the code of GetReqByPath, see example: ' "Find a specified requirement in a specified folder" ' under Req and ReqFactory. Dim reqPath$ reqPath = "Mercury Tours Application" _ & "\Online Travel Booking Services" _ & "\Products/Services On Sale" _ & "\Car Rentals" Set theReqToCover = GetReqByPath(reqPath) '------------------------------------------------------- ' Use Req.AddCoverageEx to create the coverage theReqToCover.AddCoverageEx SubjectID, TDPOSITION_LAST theReqToCover.Post ' See the covering tests that have not yet run. ' Get a test filter and set the execution status to "No Run" 'tdc is the global TDConnection object. Set testFilter = tdc.TestFactory.Filter ' Note that the quote marks must be part of the string if ' the value contains spaces. ' "No Run" would be passed as the string (No Run)and would fail. ' """No Run""" is passed as ("No Run") as required. testFilter.Filter("TS_EXEC_STATUS") = """No Run""" Dim CovList As List, aTest As ITest '------------------------------------------------------ ' Use Req.GetCoverListByFilter to ' get the filtered list of all tests, recursively, that ' cover the requirement. Set CovList = _ theReqToCover.GetCoverListByFilter(testFilter.Text, True) For Each aTest In CovList With aTest Debug.Print .name, .execStatus, .Type End With Next Exit Sub AddCoverageExErr: ' Handle error End Sub