Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate HTML report for gtest results (XML files)?

Tags:

googletest

I tried to use junitreport but XML file content is not well recognized.


@dmeister

http://code.google.com/p/googletest/issues/detail?id=114

[...] Google Test was designed to match our internal tools which expect the XML report to match the format of those produced by the "junit" Ant task, which has "testsuite" as the root element. [...]

This is what gtest (1.6.0) generates:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="0" disabled="0" errors="0" time="0" name="AllTests">
    <testsuite name="SimpleTest" tests="1" failures="0" disabled="0" errors="0" time="0">
        <testcase name="Test_1" status="run" time="0" classname="SimpleTest" />
    </testsuite>
</testsuites>

This is the error message returned by junitreport:

SimpleTest.xml is not a valid testsuite XML document

like image 768
Destroyica Avatar asked Feb 23 '23 05:02

Destroyica


2 Answers

I did it for myself with Python 2.*: https://github.com/burlachenkok/gtest_report

Also this gtest_report supports comparision of 2 or more google test results. If to be honest it was the prime goal.

like image 94
Konstantin Burlachenko Avatar answered Apr 27 '23 00:04

Konstantin Burlachenko


The junitreport expects file with testsuite as root element. It than merges multiple files with a testsuite root element together into a single report.

You can write a small helper script to split the gtest xml files into one file per testsuite tag. And then feed this files into the junit report.

The jenkins junit reporting accepts also merged test files with testsuites as root element. So it accepts the files generated by gtest directly.

like image 31
dmeister Avatar answered Apr 26 '23 23:04

dmeister