1

我有一个宏来从 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。

任何帮助都感激不尽。提前致谢。

4

1 回答 1

2

由于测试可以涵盖多个需求,因此没有与测试链接的单个需求 ID。您可以使用测试对象中的GetCoverList方法来获取测试涵盖的所有需求的列表——类似于:

Set RequirementList = TestCase.GetCoverList
于 2016-10-25T07:05:48.163 回答