I have a macro to export the test cases from the QC 11, but i am not able to get the requirement Id's which were mapped to them.
For Each Node In NodesList
Set TestTree = TreeMgr.NodeByPath(Node)
Set TestFactory = TestTree.TestFactory
Set TestList = TestFactory.NewList("") 'Get a list of all from node.
'Iterate through all the tests.
For Each TestCase In TestList
Dim DesignStepFactory, DesignStep, DesignStepList
Set DesignStepFactory = TestCase.DesignStepFactory
Set DesignStepList = DesignStepFactory.NewList("")
If DesignStepList.Count = 0 Then
Sheet.Cells(Row, 1).Value = Trim(TestCase.Field("TS_TEST_ID"))
Sheet.Cells(Row, 2).Value = Trim(TestCase.Field("TS_NAME"))
Sheet.Cells(Row, 3).Value = Trim(TestCase.Field("TS_DESCRIPTION"))
Sheet.Cells(Row, 4).Value = Trim(TestCase.Field("TS_RESPONSIBLE"))
Sheet.Cells(Row, 5).Value = Trim(TestCase.Field("TS_SUBJECT").Path)
Row = Row + 1
Else
For Each DesignStep In DesignStepList
'Save a specified set of fields.
Sheet.Cells(Row, 1).Value = Trim(TestCase.Field("TS_TEST_ID"))
Sheet.Cells(Row, 2).Value = Trim(TestCase.Field("TS_NAME"))
Sheet.Cells(Row, 3).Value = Trim(TestCase.Field("TS_DESCRIPTION"))
Sheet.Cells(Row, 4).Value = Trim(TestCase.Field("TS_RESPONSIBLE"))
Sheet.Cells(Row, 5).Value = Trim(TestCase.Field("TS_SUBJECT").Path)
'Save the specified design steps.
Sheet.Cells(Row, 6).Value = Trim(DesignStep.Field("DS_STEP_NAME"))
Sheet.Cells(Row, 7).Value = Trim(DesignStep.Field("DS_DESCRIPTION"))
Sheet.Cells(Row, 8).Value = Trim(DesignStep.Field("DS_EXPECTED"))
Row = Row + 1
Next
End If
Next
Next
Here i am getting the test case Id, Name, Description, designer and path. But i am not getting the Requirement Id which is mapped to It.
any help will be much appreciated. Thanks in advance.
Since a test can cover more than one requirement, there is no single Requirement ID linked with the test. You can use the method GetCoverList from the Test Object to get a list of all requirements covered by the test—something like that:
Set RequirementList = TestCase.GetCoverList