Main Content

确定并消除可追溯性缺失

为了考虑需求集的需求可追溯性的完整性,需求集中的每项功能需求都必须具有实现链接和验证链接。除了使用实现和验证状态来跟踪进度之外,您还可以通过使用可追溯性矩阵和图来确定和可视化工程中的可追溯性缺失。

在本教程的这一步,您将查看工程中需求的可追溯性图,以可视化这些需求到设计和测试的链接,使用可追溯性矩阵来查看未链接的测试,通过创建链接来消除可追溯性缺失,以及可视化已完成的可追溯性。

可视化需求的可追溯性

打开 myAdd2 工程,该工程与 myAdd 工程相似,但它包含您在前面步骤中更改的文件的更新版本。

openProject("myAdd2");

打开 tMyAdd 测试文件和 myAddTestSpecification 需求集。

open tMyAdd
slreq.open("myAddTestSpecification");

在需求编辑器中,选择具有ID Req5 的需求。在分析部分中,点击可追溯性图

The traceability diagram for requirement 2.1 shows that the requirement links to a justification for implementation and the test tNeg for verification.

“可追溯性图”窗口显示需求同时具有实现链接和验证链接。

打开 myAdd 函数和 myAddReqs 需求集。

open myAdd
rs = slreq.open("myAddReqs");

查看需求 1 的可追溯性图。

The traceability diagram shows that requirement 1 links to the myAdd function for implementation.

“可追溯性图”窗口显示该需求只有实现链接。

确定可追溯性缺失

创建可追溯性矩阵,用于检查需求集与 tMyAdd 测试文件之间的链接:

  1. 在需求编辑器中,点击可追溯性矩阵

  2. 在“可追溯性矩阵”窗口中,点击添加

  3. 在“选择工件”对话框中,点击选择多个工件

  4. 在“配置矩阵”窗口中,右键点击可用工件窗格中的文件名,然后选择添加到左侧,以将 myAddReqs.slreqxmyAddTestSpecification.slreqx 添加到矩阵的左侧。

  5. 右键点击文件并选择添加到顶部,将 tMyAdd.m 添加到顶部。

  6. 右键点击工件并选择删除工件,从可追溯性矩阵中删除任何额外的工件。

  7. 通过点击生成矩阵来生成矩阵。

The Configure Matrix window has the myAddReqs requirement set and the myAddTestSpecification on the left, and the tMyAdd test file on top.

过滤器面板中选择以下过滤器,过滤矩阵以仅显示缺失链接的功能需求:

  • 左侧 > 类型 > 功能性

  • 左侧 > 链接 > 缺失链接

同样,您可以应用以下过滤器,以仅显示缺失链接的测试函数:

  • 顶部 > 类型 > 函数

  • 顶部 > 链接 > 缺失链接

通过点击工具条中的突出显示缺失的链接,突出显示没有链接的行和列。

The requirements in the myAddReqs requirement set do not have links to tests in the tMyAdd test file. The tests tInput, tAdd, and tOutput do not have links to requirements in either requirement set.

弥补可追溯性缺失

myAddReqs 需求集与 tMyAdd 测试文件中的测试函数之间创建链接,以弥补需求集与测试文件之间的可追溯性缺失。按住 Ctrl 选择与以下行和列对应的单元格:

  • Take two inputs 需求和 tInputs 测试函数

  • Add the inputs 需求和 tAdd 测试函数

  • Output the result 需求和 tOutput 测试函数

点击工具条中的创建链接。在“创建链接”对话框中,点击创建

The traceability matrix shows links between 3 of the 4 requirements and the 3 tests.

为链接最后一个未链接的需求,请清除过滤器顶部 > 链接 > 缺失链接。在 Inputs should be finite 需求与 tFinite 测试函数之间创建链接。

The mouse points to the cell corresponding to the requirement that has the summary Inputs should be finite and the test tFinite.

保存链接集。在需求编辑器中,点击保存 > 全部保存

可视化已完成的可追溯性

重新打开 myAddReqs 需求集中需求 1 的可追溯性图。

req = find(rs,Index=1);
slreq.generateTraceabilityDiagram(req)

通过点击分析刷新可追溯性图。

The traceability diagram shows that requirement 1 now has a verification link to tInputs.

“可追溯性图”窗口显示需求现在同时具有实现链接和验证链接。

另请参阅

App

函数

相关主题