Import gtest xml output as JUnit


(Julian) #1


We’re running our C++ UnitTests with Google Test. Now we want to import the test results as XML into our Continua CI. Google Tests generates mostly JUnit compatible XML-output, so we can use the “Import JUnit Tests” action and it works. But we couldn’t figure out to what value (if any) the “assembly” column is mapped to. Is there anyway to set the assembly name when importing UnitTest results from a xml file? It would make filtering tests a lot easier.

gtest outputs xml like the following:

<?xml version="1.0" encoding="UTF-8"?>
  <testsuite name="TestFixtureName" tests="4" failures="0" errors="0" skipped="0" time="0.001" timestamp="2019-04-09T19:23:58">
    <testcase classname="TestFixtureName" name="ValueExists" time="0.001" />
    <testcase classname="TestFixtureName" name="SetValue" time="0" />
    <testcase classname="TestFixtureName" name="GetValue" time="0" />
    <testcase classname="TestFixtureName" name="assignment" time="0" />
  <testsuite name="TestFixtureName2" tests="2" failures="0" errors="0" skipped="0" time="0.001" timestamp="2019-04-09T19:25:00">
    <testcase classname="Namespace.TestFixtureName2" name="ChangeValue" time="0.001" />
    <testcase classname="Namespace.TestFixtureName2" name="DeleteValue" time="0" />

And look in Continua like this (after “Import JUnit Tests”):

Any help would be greatly appreciated :slight_smile:

Import JUnit Tests problems
(Dave Sparks) #2

Hi Julian,

The action currently looks for a package attribute on the testsuite element which is optional according to the JUnit XML reporting file format.

We have just uploaded new versions (v1.9.0.430 and v1.9.1.170 Beta) of Continua CI. These versions include additional Import JUnit Tests settings to will allow you choose to use the filename or a specified value when this attribute is missing (or always).

(Julian) #3

Hi Sparky,

Thank you for your quick response and of course for this quick update!
I will have to install the new version and have a go at it.