Requirements tracing
Requirements in Flex
Requirements tracing ties your requirements to the evidence that they’re met. You write the requirements in your Flex model, next to the protocols that satisfy them, so they’re checked and versioned with the rest of it. Tenon then traces them against the results of your model checks and component tests.
A requirement set is an enum, such as Thermal, with one
member for each requirement and the requirement’s text as its value.
@RequirementID gives a member the id your requirements
document uses, such as THM_001, and without one the id is
the member’s own name. @RequirementMeta adds key and value
pairs to the report: document names the set’s source
document and heads its section of the report, and any other key is
carried into the JSON report for your own tools to read.
A protocol claims a requirement with a claim annotation, such as
@Satisfies: an annotation with one parameter, of the set’s
enum type, and Requirement in its scope list. Only a claim
on a global protocol or a local protocol
counts; one anywhere else is reported as ignored.
tenon verify requirements --docs prints every rule for
writing requirements, with examples.
annotation RequirementID(id: string) | EnumValue |
annotation RequirementMeta(key: string, value: string)
| Enum EnumValue |
annotation Satisfies(req: Thermal)
| Requirement LocalProtocol GlobalProtocol |
@RequirementMeta("document", "Thermal SRS")
enum Thermal string {
@RequirementID("THM_001")
T1 = "Every temperature request gets a reading";
@RequirementID("THM_002")
T2 = "A reading carries the id of its request";
}
@Satisfies(Thermal.T1)
global protocol AcceptedThermalBand {
exch any ReadTemperature from CommandPost to Radar;
exch any Temperature from Radar to CommandPost;
}
@Satisfies(Thermal.T2)
local protocol ReportTemperature in Radar {
recv let req: ReadTemperature on RequestChan;
send let rep: Temperature
where rep.id == req.id
on ReplyChan;
}Trace requirements
tenon verify requirements reports which of your
requirements the verification evidence supports. It reads the
requirements and claims in your Flex sources, then matches each claim
against the results you hand it: a model check saved
as JSON, the results.json from a component test, or
both. A claim on a global protocol is answered by the model check, and a
claim on a local protocol by the test of the component it belongs
to.
Each requirement then gets one of four statuses. It’s
supported when every protocol that claims it passed,
and contradicted when any of them failed. It’s
unknown when a claim has no evidence, or only
inconclusive evidence, so handing in more results would settle it, and
unclaimed when no protocol claims it at all, which
needs a change to the model instead. With only the model check’s
results, for example, THM_001 is supported and
THM_002 is unknown, because nothing has tested Radar
yet.
Tenon prints the report in the terminal, or with
--format, saves it as JSON or as a PDF verification matrix
to share, with each requirement set in its own section. A model check’s
results record the sources they checked, so when your sources have
changed since, Tenon warns that the file doesn’t match and should be run
again. A component test’s results don’t record them, so Tenon warns that
they may not match, every time. A workflow can
trace requirements on every run, against results that are always
fresh.
Command:
tenon verify requirements [options] [<dir>...]
Arguments
<dir>...-
The folders of
.flexfiles that hold your requirements and protocols, as one model. Defaults to the current folder.
Options
--verifier <path>-
A component test’s
results.json. Separate several with commas, or repeat the option; results for different components are merged. --modelcheck <path>- The model check’s results, saved as JSON.
--requirement <pattern>-
Report only the matching requirements: a substring of a requirement’s id
or Flex name, in any case, or a glob with
*or?that matches all of it. Separate several with commas, or repeat the option. --format <json|pdf>- Save the report as JSON or as a PDF, instead of printing it.
--out <path>-
Where to save it: a folder, for
trace-report.jsonortrace-report.pdf, or a file whose extension matches the format. Needs--format. Defaults to printing JSON, and to saving a PDF in the current folder. --docs- Print the rules for writing requirements in Flex, and write no report.
You need --verifier, --modelcheck or both,
except with --docs.
Exit codes
| Code | Meaning |
|---|---|
0 |
The report was written, whatever the requirements’ status |
1 |
An input couldn’t be read, or the report couldn’t be written |
tenon verify requirements spec --modelcheck reports/modelcheck.json \ --verifier reports/verifier/Radar/results.jsontenon verify requirements spec --modelcheck reports/modelcheck.json \ --requirement "THM_*" --format pdf --out reports