-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrequirements-traceability-matrix.md.j2
More file actions
135 lines (107 loc) · 4.77 KB
/
requirements-traceability-matrix.md.j2
File metadata and controls
135 lines (107 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
title: "Requirements traceability matrix for amp-devcontainer"
author: ["@rjaegers"]
colorlinks: true
date: "{{ sbdl['doc_control']['custom:generated_at'] }}"
keywords: [Traceability, Requirements, RTM, amp-devcontainer]
lang: "en"
titlepage: true
titlepage-color: "0B5ED7"
titlepage-text-color: "FFFFFF"
titlepage-rule-color: "FFFFFF"
titlepage-rule-height: 2
toc: true
toc-own-page: true
header-includes:
- \AtEndDocument{\label{lastpage}}
{% if sbdl['doc_control']['custom:is_release'] != 'true' %}
watermark: "DRAFT"
{% endif %}
footer-right: "\\thepage \\hspace{1pt} of \\pageref*{lastpage}"
...
{% macro reencode(text) -%}
{{ text.encode('utf-8').decode('unicode_escape') }}
{%- endmacro -%}
{%- macro strip_gherkin_prefix(text) -%}
{{ text | replace('Rule: ', '') | replace('Feature: ', '') }}
{%- endmacro -%}
{%- macro strip_bats_syntax(text) -%}
{{ text | replace('@test "', '') | replace('" \{', '') | replace('" {', '') }}
{%- endmacro -%}
{%- macro display_short(text) -%}
{{ text[:60] }}
{%- endmacro %}
# Introduction
## Purpose
This document provides a requirements traceability matrix (RTM) for amp-devcontainer. It maps each requirement to its associated verification tests, providing evidence of test coverage across the system.
## Abstract
amp-devcontainer is a set of [devcontainers](https://containers.dev/) tailored towards modern, embedded, software development. This traceability matrix traces requirements from the *Software Requirements Specification (SRS)* to their corresponding verification tests as enumerated in the *Software Test Plan (STP)*.
## Document Control
| Property | Value |
|-------------------|-------------------------------------------------------|
| Document version | {{ sbdl['doc_control']['custom:version'] }} |
| Generation date | {{ sbdl['doc_control']['custom:generated_at'] }} |
| Source revision | {{ sbdl['doc_control']['custom:git_sha'] }} |
| Source branch/tag | {{ sbdl['doc_control']['custom:git_ref'] }} |
| Model | SBDL {{ sbdl['doc_control']['custom:sbdl_compiler_version'] }} (DSL {{ sbdl['doc_control']['custom:sbdl_dsl_version'] }}) |
This document is generated from a formal model defined in [sbdl](https://sbdl.dev) and versioned alongside the source code in Git.
The authoritative source of change history is the [Git log](https://github.com/philips-software/amp-devcontainer/commits/) of the source material from which the model is built.
# Traceability Matrix
{%- for aspect_id, aspect in sbdl.items() %}
{%- if aspect.type == 'aspect' %}
## {{ reencode(strip_gherkin_prefix(aspect['custom:title'])) }}
| Requirement | Test | Status |
|-------------|------|--------|
{%- if 'requirement' in aspect %}
{%- for req_ref in aspect.requirement %}
{%- set req = sbdl[req_ref.identifier] %}
{%- set req_name = reencode(strip_gherkin_prefix(req['custom:title'])) | trim %}
{%- set ns_tests = namespace(test_list=[]) -%}
{%- for test_id, test_elem in sbdl.items() -%}
{%- if test_elem.type == 'test' -%}
{%- if 'requirement' in test_elem -%}
{%- for test_req_ref in test_elem.requirement if test_req_ref.identifier == req_ref.identifier -%}
{%- set _ = ns_tests.test_list.append(test_id) -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if ns_tests.test_list -%}
{%- for test_id in ns_tests.test_list %}
{%- set test_name = strip_bats_syntax(strip_gherkin_prefix(sbdl[test_id]['custom:title'])) | trim %}
| {{ display_short(req_name) }} | {{ test_id }}: {{ display_short(test_name) | capitalize }} | Traced |
{%- endfor -%}
{%- else %}
| {{ display_short(req_name) }} | — | **Not covered** |
{%- endif -%}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}
# Coverage Summary
{%- set ns_summary = namespace(total_reqs=0, covered_reqs=0, total_tests=0) -%}
{%- for elem_id, elem in sbdl.items() -%}
{%- if elem.type == 'requirement' -%}
{%- set ns_summary.total_reqs = ns_summary.total_reqs + 1 -%}
{%- set ns_covered = namespace(is_covered=false) -%}
{%- for test_id, test_elem in sbdl.items() -%}
{%- if test_elem.type == 'test' and 'requirement' in test_elem -%}
{%- for req_ref in test_elem.requirement if req_ref.identifier == elem_id -%}
{%- set ns_covered.is_covered = true -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- if ns_covered.is_covered -%}
{%- set ns_summary.covered_reqs = ns_summary.covered_reqs + 1 -%}
{%- endif -%}
{%- endif -%}
{%- if elem.type == 'test' -%}
{%- set ns_summary.total_tests = ns_summary.total_tests + 1 -%}
{%- endif -%}
{%- endfor %}
| Metric | Value |
|---|---|
| Total requirements | {{ ns_summary.total_reqs }} |
| Requirements with tests | {{ ns_summary.covered_reqs }} |
| Requirements without tests | {{ ns_summary.total_reqs - ns_summary.covered_reqs }} |
| Total tests | {{ ns_summary.total_tests }} |