Skip to content

Enrich JUnit file

Add UUID, version, item and date, and the variant’s UUID when there is one, to every test case of a JUnit XML file that names an element by short ID, UUID or identifier, or by a short ID in another form that a name pattern finds. Test cases with an unknown reference, or whose variant does not fit, stay unchanged and are listed; the CLI exits 1. The output counts the test cases that name no element.

Command evidence.enrichJunit. Writes files in the working tree, never to Git. It is refused while the workspace is read-only. Writes the current versions of the elements, which depend on the metamodel (which properties count).

Field Type Required Description
file localPath yes The JUnit XML file to enrich. It is rewritten in place unless output is given. A test case that already has a reqseq:version is never changed (D-026).
item item yes The item under test (Prüfling), for example the build. No white space at either end and no control characters other than tab, line feed and carriage return.
date dateTime no The date of the test run. Default: an existing reqseq:date of the test case, else the timestamp of its test suite when that has a time zone, else the time of the call.
variant elementRef no The variant the test run was for (an element whose type has the meaning variant): each enriched test case gets its UUID as reqseq:variant. Absent: a test case keeps its own reqseq:variant, if any, whose short ID or identifier becomes the UUID; core is none, but is checked like a variant. A test case that names another variant, or names an element that does not count in its variant (not valid there, excluded or replaced, as at evidence.record), stays unchanged and gets evidence.invalid-record; so does an enriched test case (never changed, D-026) whose variant differs from the given one.
namePattern string no A template that finds a short ID written in another form in test case names, for names that cannot hold brackets, e.g. {prefix}_{id}_ak{ak} for sr_348143_ak1 (SR-348143). {prefix} is a type prefix of the metamodel, {id} 6 to 32 hex digits, {ak} 1 to 9 digits (ignored); {prefix} and {id} once each, {ak} once at most and not next to {id}. The rest is literal text; {{ and }} are braces, square brackets are refused. All of it is ASCII case-insensitive. A match starts and ends at a word boundary (the start or end of the name, a character that is not a letter or digit, or the start of a camel case word) and is looked for in the name outside [...] only, not in the class name. It adds to the bracket form and the reqseq:element property; a short ID it finds that names no element, or several, is listed in unknown.
output localPath no Default: overwrite the input file. An existing file is replaced only when it is a JUnit XML file the scanner accepts; its folder must exist.
Field Type Required Description
testCases integer yes The test cases that name at least one element and are enriched: by this call, or already before.
withoutReference integer yes The test cases that name no element: no reqseq:element property and no name token or pattern match that names one (a pytest parameter list counts here). Test cases enriched already, listed in unknown or refused are not counted. Information only: it does not change the exit code.
unknown array of object yes Each reference that names no element or more than one, with its test case; that test case stays unchanged.
unknown[].testCase string yes
unknown[].className string no
unknown[].line integer yes The line of the <testcase> in the file as read.
unknown[].ref string yes
files array of string yes The written file, relative to the workspace root (the folder of the main repository) with / when it lies below it or in another repository of the workspace, else its absolute path. None when nothing is written: nothing to change in place, or output holds these bytes already; a given output is otherwise written even when nothing changes.
problems array of problem yes

In the command prompt (Ctrl+Shift+P, macOS ⌘⇧P): the command Enrich JUnit file.

reqseq evidence enrich-junit, with --json for the output as JSON. Its help:

Usage: reqseq evidence enrich-junit <file> <item> [options]
Add UUID, version, item and date, and the variant's UUID when there is one, to
every test case of a JUnit XML file that names an element by short ID, UUID or
identifier, or by a short ID in another form that a name pattern finds. Test
cases with an unknown reference, or whose variant does not fit, stay unchanged
and are listed; the CLI exits 1. The output counts the test cases that name no
element.
Arguments:
file The JUnit XML file to enrich. It is rewritten in place
unless `output` is given. A test case that already has
a `reqseq:version` is never changed (D-026).
item The item under test (Prüfling), for example the build.
No white space at either end and no control characters
other than tab, line feed and carriage return.
Options:
--file <value> instead of the argument <file>
--item <value> instead of the argument <item>
--date <value> The date of the test run. Default: an existing
`reqseq:date` of the test case, else the `timestamp`
of its test suite when that has a time zone, else the
time of the call.
--variant <value> The variant the test run was for (an element whose
type has the meaning variant): each enriched test case
gets its UUID as `reqseq:variant`. Absent: a test case
keeps its own `reqseq:variant`, if any, whose short ID
or identifier becomes the UUID; `core` is none, but is
checked like a variant. A test case that names another
variant, or names an element that does not count in
its variant (not valid there, excluded or replaced, as
at `evidence.record`), stays unchanged and gets
`evidence.invalid-record`; so does an enriched test
case (never changed, D-026) whose variant differs from
the given one.
--name-pattern <value> A template that finds a short ID written in another
form in test case names, for names that cannot hold
brackets, e.g. `{prefix}_{id}_ak{ak}` for
`sr_348143_ak1` (SR-348143). `{prefix}` is a type
prefix of the metamodel, `{id}` 6 to 32 hex digits,
`{ak}` 1 to 9 digits (ignored); `{prefix}` and `{id}`
once each, `{ak}` once at most and not next to `{id}`.
The rest is literal text; `{{` and `}}` are braces,
square brackets are refused. All of it is ASCII
case-insensitive. A match starts and ends at a word
boundary (the start or end of the name, a character
that is not a letter or digit, or the start of a camel
case word) and is looked for in the name outside
`[...]` only, not in the class name. It adds to the
bracket form and the `reqseq:element` property; a
short ID it finds that names no element, or several,
is listed in `unknown`.
--output <value> Default: overwrite the input file. An existing file is
replaced only when it is a JUnit XML file the scanner
accepts; its folder must exist.
--input <json|@file|-> command input as JSON: inline, from a file, or from
standard input
--workspace <path> workspace root (default: nearest folder upwards with
reqseq-workspace.yaml)
--json print exactly the command output as JSON
--yaml print the whole command output as YAML, problems one
per line
-h, --help show help

POST /v1/commands/evidence.enrichJunit on the local API (reqseq serve api), with the input as the JSON body; the answer is the output.

Tool evidence_enrichJunit of the MCP server (reqseq mcp), with the input as its arguments.