1KYUA-REPORT-JUNIT(1) BSD General Commands Manual KYUA-REPORT-JUNIT(1)
2
4 kyua report-junit — Generates a JUnit report with the results of a test
5 suite run
6
8 kyua report-junit [--output path] [--results-file file]
9
11 The kyua report-junit command provides a simple mechanism to generate
12 JUnit reports of the execution of a test suite. The command processes a
13 results file and then generates a single XML file that complies with the
14 JUnit XSchema.
15
16 The JUnit output is static and self-contained, so it can easily be
17 plugged into any continuous integration system, like Jenkins.
18
19 The following subcommand options are recognized:
20
21 --output directory
22 Specifies the file into which to store the JUnit report.
23
24 --results-file path, -s path
25 Specifies the results file to operate on. Defaults to ‘LATEST’,
26 which causes kyua report-junit to automatically load the latest
27 results file from the current test suite.
28
29 The following values are accepted:
30
31 ‘LATEST’
32 Requests the load of the latest results file available for the
33 test suite rooted at the current directory.
34
35 Directory
36 Requests the load of the latest results file available for the
37 test suite rooted at the given directory.
38
39 Test suite name
40 Requests the load of the latest results file available for the
41 given test suite.
42
43 Results identifier
44 Requests the load of a specific results file.
45
46 Explicit file name (aka everything else)
47 Load the specified results file.
48
49 See Results files for more details.
50
51 Caveats
52 Because of limitations in the JUnit XML schema, not all the data col‐
53 lected by Kyua can be properly represented in JUnit reports. However,
54 because test data are extremely useful for debugging purposes, the kyua
55 report-junit command shovels these data into the JUnit output. In par‐
56 ticular:
57
58 · The test case metadata values are prepended to the test case's stan‐
59 dard error output.
60
61 · Test cases that report expected failures as their results are
62 recorded as passed. The fact that they failed as expected is
63 recorded in the test case's standard error output along with the cor‐
64 responding reason.
65
66 Results files
67 Results files contain, as their name implies, the results of the execu‐
68 tion of a test suite. Each test suite executed by kyua-test(1) generates
69 a new results file, and such results files can be loaded later on by
70 inspection commands such as kyua-report(1) to analyze their contents.
71
72 Results files support identifier-based lookups and also path name
73 lookups. The differences between the two are described below.
74
75 The default naming scheme for the results files provides simple support
76 for identifier-based lookups and historical recording of test suite runs.
77 Each results file is given an identifier derived from the test suite that
78 generated it and the time the test suite was run. Kyua can later look up
79 results files by these fileds.
80
81 The identifier follows this pattern:
82
83 <test_suite>.<YYYYMMDD>-<HHMMSS>-<uuuuuu>
84
85 where ‘test_suite’ is the path to the root of the test suite that was run
86 with all slashes replaced by underscores and ‘YYYYMMDD-HHMMSS-uuuuuu’ is
87 a timestamp with microsecond resolution.
88
89 When using the default naming scheme, results files are stored in the
90 ~/.kyua/store/ subdirectory and each file holds a name of the form:
91
92 ~/.kyua/store/results.<identifier>.db
93
94 Results files are simple SQLite databases with the schema described in
95 the /usr/share/kyua/store/schema_v?.sql files. For details on the
96 schema, please refer to the heavily commented SQL file.
97
99 The kyua report-junit command always returns 0.
100
101 Additional exit codes may be returned as described in kyua(1).
102
104 Workflow with results files
105 Let's say you run the following command twice in a row:
106
107 kyua test -k /usr/tests/Kyuafile
108
109 The two executions will generate two files with names like these:
110
111 ~/.kyua/store/results.usr_tests.20140731-150500-196784.db
112 ~/.kyua/store/results.usr_tests.20140731-151730-997451.db
113
114 Taking advantage of the default naming scheme, the following commands
115 would all generate a report for the results of the latest execution of
116 the test suite:
117
118 cd /usr/tests && kyua report-junit
119 cd /usr/tests && kyua report-junit --results-file=LATEST
120 kyua report-junit --results-file=/usr/tests
121 kyua report-junit --results-file=usr_tests
122 kyua report-junit --results-file=usr_tests.20140731-151730-997451
123
124 But it is also possible to explicitly load data for older runs or from
125 explicitly-named files:
126
127 kyua report-junit \
128 --results-file=usr_tests.20140731-150500-196784
129 kyua report-junit \
130 --results-file=~/.kyua/store/results.usr_tests.20140731-150500-196784.db
131
133 kyua(1), kyua-report(1), kyua-report-html(1)
134
135BSD October 13, 2014 BSD