Using gtest with hudson

457 views
Skip to first unread message

sqook

unread,
Dec 29, 2008, 9:43:25 AM12/29/08
to Google C++ Testing Framework
I've run into some problems while trying to integrate my hudson CI
server with XML test results published by gtest. Namely, hudson
always reports that "None of the test reports contained any result".
After doing a bit of googling, I found a bug report for issue #74
(http://code.google.com/p/googletest/issues/detail?id=74) which had
been closed as "wontfix", as the XML generated by gtest is for
individual results.

I then got the idea to make a junitreport task in my ant build script,
which assembles an XML report based on the original XML output of
gtest. This works fine, and I've looked at the output and it looks
something like this:

<testsuites>
<testsuite disabled="0" errors="0" failures="0" id="0"
name="AllTests" package="" tests="369" time="34.578">
<testsuite disabled="0" errors="0" failures="0" name="blah"
tests="7" time="9.469">
<testcase classname="application" name="blah_blah_blah"
status="run" time="0" />
....
</testsuite>
</testsuite>
</testsuites>

I'm not a Java guy (hence gtest), so unfortunately, I'm not really
familiar with what the "correct" output should look like. At any
rate, when I point hudson towards this XML file, it generates the same
error as when I pointed it towards the raw XML output -- it claims no
results could be read. Has anyone else run into this? Any
workarounds or fixes for this problem?

yop

unread,
Jan 21, 2009, 5:14:14 AM1/21/09
to Google C++ Testing Framework
I 'm also in the same spot right now. I tried to get the xml reports
from gtest used by hudson but the according to this issue:
http://code.google.com/p/googletest/issues/detail?id=74 it is not
possible. Has anyone managed to get a work around? Maybe an xslt step
after publishing the results?
> rate, when I pointhudsontowards this XML file, it generates the same

Michael

unread,
Feb 5, 2009, 8:41:31 PM2/5/09
to Google C++ Testing Framework
I am using phpunit with Hudson and getting stuck as well. Like yop
said, if I knew what the output SHOULD look like, I could probably do
a transformation. Any assistance here would be awesome!

On Jan 21, 2:14 am, yop <y.pag...@gmail.com> wrote:
> I 'm also in the same spot right now. I tried to get the xml reports
> from gtest used by hudson but the according to this issue:http://code.google.com/p/googletest/issues/detail?id=74it is not

Zhanyong Wan (λx.x x)

unread,
Feb 5, 2009, 8:50:57 PM2/5/09
to Michael, Google C++ Testing Framework
2009/2/5 Michael <mro...@gmail.com>:

>
> I am using phpunit with Hudson and getting stuck as well. Like yop
> said, if I knew what the output SHOULD look like, I could probably do
> a transformation. Any assistance here would be awesome!

I haven't used Hudson myself, so I don't know what exact format it
expects either. :-(

Since this is a question about Hudson, have you asked it on Hudson's
forum or mailing list?

--
Zhanyong

sqook

unread,
Feb 9, 2009, 9:15:09 PM2/9/09
to Google C++ Testing Framework
I've found the source of the problem -- it's because gtest puts all
the testsuite's in a single XML file. If you break it up into
individual XML files, then hudson reads them correctly. I've filed
bug reports for both projects, as gtest could offer an option to
either generate one XML file per class, or hudson could support the
XML format generated by gtest. Anyways, in the meantime, I wrote a
perl script as a workaround to this issue:

http://www.teragon.org/stuff/SO/gtest-hudson.pl

It's not pretty, but you can call it from ant and hudson seems to pick
up the test results from it.

On 6 Feb, 02:50, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> 2009/2/5 Michael <mroo...@gmail.com>:
>
>
>
> > I am using phpunit with Hudson and getting stuck as well. Like yop
> > said, if I knew what the output SHOULD look like, I could probably do
> > a transformation. Any assistance here would be awesome!
>
> I haven't used Hudson myself, so I don't know what exact format it
> expects either. :-(
>
> Since this is a question about Hudson, have you asked it on Hudson's
> forum or mailing list?
>
>
>
>
>
> > On Jan 21, 2:14 am, yop <y.pag...@gmail.com> wrote:
> >> I 'm also in the same spot right now. I tried to get the xml reports
> >> from gtest used by hudson but the according to this issue:http://code.google.com/p/googletest/issues/detail?id=74itis not

Zhanyong Wan (λx.x x)

unread,
Feb 9, 2009, 9:34:59 PM2/9/09
to sqook, Google C++ Testing Framework
On Mon, Feb 9, 2009 at 6:15 PM, sqook <njre...@gmail.com> wrote:
>
> I've found the source of the problem -- it's because gtest puts all
> the testsuite's in a single XML file. If you break it up into
> individual XML files, then hudson reads them correctly. I've filed
> bug reports for both projects, as gtest could offer an option to
> either generate one XML file per class, or hudson could support the
> XML format generated by gtest. Anyways, in the meantime, I wrote a
> perl script as a workaround to this issue:
>
> http://www.teragon.org/stuff/SO/gtest-hudson.pl
>
> It's not pretty, but you can call it from ant and hudson seems to pick
> up the test results from it.

Thanks for the update and sharing the script!

A test program can contain many test fixture classes, so it can be
rather inefficient to generate one XML file for each of them.
Therefore I prefer the problem to be solved on Hudson's side. :-)

--
Zhanyong

Reply all
Reply to author
Forward
0 new messages