Descriptions and records
How a test is described, how a description is joined to its tests, and what a run records. The three
are checked by one tool, yoke-verify, published from yoke.
A description
One file per feature, <feature>.std.md, beside the tests that perform its cases, in English.
- One
H1naming the feature, then a table of two rows: Feature, a sentence saying what it does, and Planning item, written<owner>/<repository>#<number>. <feature>is kebab-case, unique within the repository, and the file's basename.
A case
An H2 reading <identifier> — <title>, then a table of eight fields, in this order and no other.
| Field | Holds | Written |
|---|---|---|
| Cites | the rules the case exercises | one or more, separated by · |
| Level | the level that runs it | L0, L1, L3, L4 or L5 |
| Method | how it shows the rule holds | test or check |
| Not applicable in | the environments it does not apply to | —, or dimension: value pairs separated by · |
| Label | what its failure stops | blocking, or not blocking — <owner>/<repository>#<number> |
| Precondition | the state it starts from | prose |
| Action | what is done | prose |
| Expected | what must be observed for the rule to hold | prose |
- Expected is something observed — a state, an output, a record, an absence that can be checked — never works correctly.
- Cites names rules of the project's specification, which is not published. Descriptions are the one place public files cite it: the citation is what joins a case to the rule it verifies.
The identifier
<repository>:<feature>.<nn> — for example yoke:manager-install.01.
- It is unique across the project.
- A number is never reused. A deleted case is struck and kept: its heading reads
## ~~<identifier> — <title>~~, with no table. - It stays the same when the rule it cites is renamed or moved.
Joining a case to its test
The test performing a case carries a marker, a comment line that is nothing else: // std: <identifier>,
# std: <identifier> or /* std: <identifier> */.
One case, one test; one test, one case. A case with no marker, or a marker naming no case, fails the repository's checks.
The record of a run
Every run writes one record, as JSON.
| Field | Holds |
|---|---|
schema | the record schema's version |
repository, commit | where the run happened |
level, tier | the level, and reference or complete |
environment | the value of each environment dimension the run fixed |
started, finished | instants in UTC |
ran | every artifact the run involved, each with name, version and commit |
state | passed, failed or not reached |
blocks | whether a blocking case failed or is absent |
cases | per case: id, result, label, the item a not blocking label cites, and detail on failure |
| Result | Means |
|---|---|
pass | the test ran and the rule held |
fail | the test ran and the rule did not hold — or the runner reported it skipped: nothing is skipped |
absent | the description declares the case and the run produced no result: a failure |
not applicable | the description declares the case inapplicable here; computed from the declaration |
The record is built from what the run already printed: a Go test runner's JSON output, and a check's
own lines, pass <id> and FAIL <id> — <what failed>.
One run may perform several levels — yoke's test verb performs L1 and L3 — and it writes one record
per level. Each record takes the results of the cases declared at its level and leaves the others to
their own level's record; only a result that answers no case at all is refused.
yoke-verify
| Command | Does | Fails when |
|---|---|---|
yoke-verify descriptions [--repository <name>] [--emit json] <root> | checks every description's form, and lists its cases — or emits them as JSON | a description breaks its form, or an identifier repeats |
yoke-verify markers [--repository <name>] <root> | pairs every case with its test, and prints the pairs | a case has no test, a test has two cases, or a marker names no case |
yoke-verify record --level <level> --results <file> … <root> | writes the record of a run from what it left behind: --results once per output file, --started and --finished, --environment dimension=value, --ran name=version@commit, --not-reached | either of the above, or a result it cannot join to a case |
just test runs the first two, and continuous integration runs the third after the verbs. For now each repository runs it from the Go module with go run; from 0.2, just develop installs the published binary.