简体   繁体   中英

Is googletest test-report format a standard?

Below is the xml-format output generated from invoking my googletest:

$ GTEST_OUTPUT=xml:/path/to/ ctest --verbose
$ cat /path/to/IntUtilsTest.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="0" disabled="0" errors="0" timestamp="2021-07-07T23:25:35" time="0.008" name="AllTests">
  <testsuite name="gitflow_tester" tests="1" failures="0" disabled="0" errors="0" time="0.002">
    <testcase name="zero_plus_five_equals_5" status="run" time="0.001" classname="gitflow_tester" />
  </testsuite>
</testsuites>

Is the googletest xml-format test result output a standard?
Ie does the above conform to a schema followed by all test packages that generate xml-format test results?
In other words, if something parsed/programmatically reacted to the above xml, could it be expected to need no change if the test suite were changed from googletest to cxxtest or cpptest, etc.?


What I've tried:

Validating the noted xml example using the JUnit xsd here:https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd using the following two xml/xsd validators:

Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'disabled' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'time' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'name' Is Not Allowed To Appear In Element 'testsuites'., Line '1', Column '121'.
Cvc-complex-type.3.2.2: Attribute 'disabled' Is Not Allowed To Appear In Element 'testsuite'., Line '2', Column '96'.
Cvc-complex-type.4: Attribute 'package' Must Appear On Element 'testsuite'., Line '2', Column '96'.
Cvc-complex-type.4: Attribute 'id' Must Appear On Element 'testsuite'., Line '2', Column '96'.
Cvc-complex-type.4: Attribute 'timestamp' Must Appear On Element 'testsuite'., Line '2', Column '96'.
Cvc-complex-type.4: Attribute 'hostname' Must Appear On Element 'testsuite'., Line '2', Column '96'.
Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'testcase'. One Of '{properties}' Is Expected., Line '3', Column '101'.
Cvc-complex-type.3.2.2: Attribute 'status' Is Not Allowed To Appear In Element 'testcase'., Line '3', Column '101'.

I found a better XML Schema for JUnit here:

https://github.com/junit-team/junit5/releases/tag/r5.7.2

Download the ZIP and look for jenkins-junit.xsd

or use directly:

https://raw.githubusercontent.com/junit-team/junit5/main/platform-tests/src/test/resources/jenkins-junit.xsd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM