我有一个宏来从QC 11导出测试用例,但是我无法获得映射到它们的要求ID。
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
这里我得到测试用例Id,名称,描述,设计者和路径。但我没有得到映射到它的需求ID。
任何帮助将不胜感激。提前谢谢。
答案 0 :(得分:2)
由于测试可以涵盖多个要求,因此没有单独的要求ID与测试相关联。您可以使用测试对象中的方法GetCoverList来获取测试所涵盖的所有要求的列表 - 如下所示:
Set RequirementList = TestCase.GetCoverList