Public Sub AddCoverageByFilter() ' Cover a requirement with selected tests in a folder Dim SubjectID As Variant Dim TestFact As TestFactory Dim testFilter As TDFilter Dim aReq As Req On Error GoTo AddCoverageByFilterErr ' Get the requirement to be covered. Dim reqPath$ reqPath = "Mercury Tours Application" _ & "\Online Travel Booking Services" _ & "\Products/Services On Sale" _ & "\Tours/Cruises" ' For the code of GetReqByPath, see example ' "Find a specified requirement in a specified folder" Set aReq = GetReqByPath(reqPath) ' Define the test filter: ' Tests in Design Status whose ' names begin with "Demo". 'tdc is the global TDConnection object. Set TestFact = tdc.TestFactory Set testFilter = TestFact.Filter testFilter.Filter("TS_NAME") = "demo*" testFilter.Filter("TS_STATUS") = "Design" ' Get the test subject node under which ' to look for the "Demo*" tests. Dim SubjNode As SubjectNode, sPath$ sPath = "OTA_DEMO_SUBJECT" _ & "\OTA_SUBJECT_level1" _ & "\OTA_SUB_1.2" ' For the code of GetSubjectNodeByPath, see example: ' "Getting a test subject node by the node path" Set SubjNode = GetSubjectNodeByPath(sPath) SubjectID = SubjNode.NodeID '------------------------------------------------- ' Use Req.AddCoverageByFilter to add all the ' Demo* tests in the subject folder to ' the list of tests covering the requirement. aReq.AddCoverageByFilter _ SubjectID, _ TDPOSITION_LAST, _ testFilter.Text Exit Sub AddCoverageByFilterErr: End Sub