Adjust documentation regarding xml and json source file location otput.

pull/3774/head
Szymon Sobik 3 years ago
parent 5c1b42a58d
commit 132059ba0c
  1. 20
      docs/advanced.md
  2. 4
      docs/reference/testing.md

@ -839,7 +839,7 @@ will output XML like this:
```xml ```xml
... ...
<testcase name="MinAndMaxWidgets" status="run" time="0.006" classname="WidgetUsageTest" MaximumWidgets="12" MinimumWidgets="9" /> <testcase name="MinAndMaxWidgets" file="test.cpp" line="1" status="run" time="0.006" classname="WidgetUsageTest" MaximumWidgets="12" MinimumWidgets="9" />
... ...
``` ```
@ -2082,15 +2082,15 @@ could generate this report:
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="1" errors="0" time="0.035" timestamp="2011-10-31T18:52:42" name="AllTests"> <testsuites tests="3" failures="1" errors="0" time="0.035" timestamp="2011-10-31T18:52:42" name="AllTests">
<testsuite name="MathTest" tests="2" failures="1" errors="0" time="0.015"> <testsuite name="MathTest" tests="2" failures="1" errors="0" time="0.015">
<testcase name="Addition" status="run" time="0.007" classname=""> <testcase name="Addition" file="test.cpp" line="1" status="run" time="0.007" classname="">
<failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type="">...</failure> <failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type="">...</failure>
<failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type="">...</failure> <failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type="">...</failure>
</testcase> </testcase>
<testcase name="Subtraction" status="run" time="0.005" classname=""> <testcase name="Subtraction" file="test.cpp" line="2" status="run" time="0.005" classname="">
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite name="LogicTest" tests="1" failures="0" errors="0" time="0.005"> <testsuite name="LogicTest" tests="1" failures="0" errors="0" time="0.005">
<testcase name="NonContradiction" status="run" time="0.005" classname=""> <testcase name="NonContradiction" file="test.cpp" line="3" status="run" time="0.005" classname="">
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>
@ -2108,6 +2108,8 @@ Things to note:
* The `timestamp` attribute records the local date and time of the test * The `timestamp` attribute records the local date and time of the test
execution. execution.
* The `file` and `line` attributes record the source file location, where the test was defined.
* Each `<failure>` element corresponds to a single failed googletest * Each `<failure>` element corresponds to a single failed googletest
assertion. assertion.
@ -2147,6 +2149,8 @@ The report format conforms to the following JSON Schema:
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "type": "string" }, "name": { "type": "string" },
"file": { "type": "string" },
"line": { "type": "integer" },
"status": { "status": {
"type": "string", "type": "string",
"enum": ["RUN", "NOTRUN"] "enum": ["RUN", "NOTRUN"]
@ -2224,6 +2228,8 @@ message TestCase {
message TestInfo { message TestInfo {
string name = 1; string name = 1;
string file = 6;
int32 line = 7;
enum Status { enum Status {
RUN = 0; RUN = 0;
NOTRUN = 1; NOTRUN = 1;
@ -2267,6 +2273,8 @@ could generate this report:
"testsuite": [ "testsuite": [
{ {
"name": "Addition", "name": "Addition",
"file": "test.cpp",
"line": 1,
"status": "RUN", "status": "RUN",
"time": "0.007s", "time": "0.007s",
"classname": "", "classname": "",
@ -2283,6 +2291,8 @@ could generate this report:
}, },
{ {
"name": "Subtraction", "name": "Subtraction",
"file": "test.cpp",
"line": 2,
"status": "RUN", "status": "RUN",
"time": "0.005s", "time": "0.005s",
"classname": "" "classname": ""
@ -2298,6 +2308,8 @@ could generate this report:
"testsuite": [ "testsuite": [
{ {
"name": "NonContradiction", "name": "NonContradiction",
"file": "test.cpp",
"line": 3,
"status": "RUN", "status": "RUN",
"time": "0.005s", "time": "0.005s",
"classname": "" "classname": ""

@ -518,8 +518,8 @@ Logs a property for the current test, test suite, or entire invocation of the
test program. Only the last value for a given key is logged. test program. Only the last value for a given key is logged.
The key must be a valid XML attribute name, and cannot conflict with the ones The key must be a valid XML attribute name, and cannot conflict with the ones
already used by GoogleTest (`name`, `status`, `time`, `classname`, `type_param`, already used by GoogleTest (`name`, `file`, `line`, `status`, `time`, `classname`,
and `value_param`). `type_param`, and `value_param`).
`RecordProperty` is `public static` so it can be called from utility functions `RecordProperty` is `public static` so it can be called from utility functions
that are not members of the test fixture. that are not members of the test fixture.

Loading…
Cancel
Save