Can anyone help with Boost C++ unit tests and the xUnit plugin?

1,033 views
Skip to first unread message

Chris Withers

unread,
Dec 14, 2011, 2:21:46 AM12/14/11
to jenkins...@googlegroups.com
Hi All,

I'm not a C++ programmer, but I'm trying to help some C++ programmers I
work with to get better feedback and trending from their Jenkins runs.

They use the Boost unit testing framework, and I thought I was getting
somewhere with the following command line:

unit_test --report_level=detailed --report_format=xml 2> xunit.xml

But the xunit plugin barfs processing this output.

The output starts like this:

<TestResult><TestSuite name="Master Test Suite" result="passed"
assertions_passed="93" assertions_failed="0" expected_failures="0"
test_cases_passed="1" test_cases_failed="0" test_cases_skipped="0"
test_cases_aborted="0"><TestSuite name="m" result="passed"
assertions_passed="93" assertions_failed="0" expected_failures="0"
test_cases_passed="1" test_cases_failed="0" test_cases_skipped="0"
test_cases_aborted="0">
...

Can anyone tell me what I'm doing wrong and how I can get the boost unit
test stuff to spit out xml that the xUnit plugin likes or tell me what
configuration change I need to make to the xUnit plugin to get this working?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Petriconi, Felix

unread,
Dec 14, 2011, 9:09:27 AM12/14/11
to jenkins...@googlegroups.com
Hi,

unfortunatly you don't provide a detailed error message.

But we had in the past the problem that our reports were written in a different encoding than what a plugin understands. We could solve this by using explicit ISO-8859-1 encoding. Per default on Windows machines is often an other encoding used, which causes confusion in the Jenkins/Java world.

Perhaps this helped.

Regards, Felix

-----Ursprüngliche Nachricht-----
Von: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] Im Auftrag von Chris Withers
Gesendet: Mittwoch, 14. Dezember 2011 08:22
An: jenkins...@googlegroups.com
Betreff: Can anyone help with Boost C++ unit tests and the xUnit plugin?

Chris Withers

unread,
Dec 15, 2011, 3:53:31 AM12/15/11
to jenkins...@googlegroups.com, Petriconi, Felix
On 14/12/2011 14:09, Petriconi, Felix wrote:
> Hi,
>
> unfortunatly you don't provide a detailed error message.

Here's the output:

+ unit_test --report_level=detailed --report_format=xml
Running 1314 test cases...
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing BoostTest-1.x (default)
[xUnit] [WARNING] - Can't create the path /var/lib/jenkins/jobs/C++ Unit
Tests/workspace/generatedJUnitFiles. Maybe the directory already exists.
[xUnit] [INFO] - [BoostTest-1.x (default)] - 1 test report file(s) were
found with the pattern 'xunit.xml' relative to
'/var/lib/jenkins/jobs/C++ Unit Tests/workspace' for the testing
framework 'BoostTest-1.x (default)'.
[xUnit] [ERROR] - The result file '/var/lib/jenkins/jobs/C++ Unit
Tests/workspace/xunit.xml' for the metric 'BoostTest' is not valid. The
result file has been skipped.
[xUnit] [ERROR] - The plugin hasn't been performed correctly:
hudson.AbortException: Test reports were found but none of them are new.
Did tests run?
For example, /var/lib/jenkins/jobs/C++ Unit
Tests/workspace/generatedJUnitFiles/BoostTest/TEST-476662636.xml is 49
min old

Build step 'Publish testing tools result report' changed build result to
FAILURE
Build step 'Publish testing tools result report' marked build as failure

> But we had in the past the problem that our reports were written in a different encoding than what a plugin understands. We could solve this by using explicit ISO-8859-1 encoding. Per default on Windows machines is often an other encoding used, which causes confusion in the Jenkins/Java world.

I think the issue here is the structure of the xml:

> <TestResult><TestSuite name="Master Test Suite" result="passed"
> assertions_passed="93" assertions_failed="0" expected_failures="0"
> test_cases_passed="1" test_cases_failed="0" test_cases_skipped="0"
> test_cases_aborted="0"><TestSuite name="m" result="passed"
> assertions_passed="93" assertions_failed="0" expected_failures="0"
> test_cases_passed="1" test_cases_failed="0" test_cases_skipped="0"
> test_cases_aborted="0">


The examples I've seen seem to start with <TestLog> which is why I asked:

Grégory Boissinot

unread,
Dec 16, 2011, 10:30:42 AM12/16/11
to jenkins...@googlegroups.com
You have to run boosttest with the following options
--output_format=XML --log_level=all --report_level=no

Chris Withers

unread,
Jan 13, 2012, 2:40:40 AM1/13/12
to jenkins...@googlegroups.com, Grégory Boissinot
On 16/12/2011 15:30, Gr�gory Boissinot wrote:
> You have to run boosttest with the following options
> --output_format=XML --log_level=all --report_level=no

Hmm, well, that doesn't seem to work.

The command we're trying in a shell build step is:

unit_test --output_format=XML --log_level=all --report_level=no >
$WORKSPACE/xunit.xml

Jenkins shows the following in the build output:

unit_test --output_format=XML --log_level=all --report_level=no


[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing BoostTest-1.x (default)
[xUnit] [WARNING] - Can't create the path /var/lib/jenkins/jobs/C++ Unit
Tests/workspace/generatedJUnitFiles. Maybe the directory already exists.
[xUnit] [INFO] - [BoostTest-1.x (default)] - 1 test report file(s) were
found with the pattern 'xunit.xml' relative to
'/var/lib/jenkins/jobs/C++ Unit Tests/workspace' for the testing
framework 'BoostTest-1.x (default)'.
[xUnit] [ERROR] - The result file '/var/lib/jenkins/jobs/C++ Unit
Tests/workspace/xunit.xml' for the metric 'BoostTest' is not valid. The
result file has been skipped.
[xUnit] [ERROR] - The plugin hasn't been performed correctly:
hudson.AbortException: Test reports were found but none of them are new.
Did tests run?
For example, /var/lib/jenkins/jobs/C++ Unit

Tests/workspace/generatedJUnitFiles/BoostTest/TEST-476662636.xml is 1 mo
0 days old

The head of xunit.xml looks like:

<TestLog><TestSuite name="Master Test Suite"><TestSuite
name="m"><TestSuite name="tst_example"><TestCase name="foo1"><Info
file="tst_example.cpp"
line="7">check 1 == 1
passed</Info><TestingTime>0</TestingTime></TestCase><TestCase
name="foo2"><Info file="tst_example.cpp" line="12">check 2 ==
2 passed</Info><TestingTime>0</TestingTime></TestCase></TestSuite>

This is exactly the behavior we saw before :-(

How can I crank up some debug logging and/or manually run the Jenkins
Xunit parser to see what, exactly, it doesn't like?

Reply all
Reply to author
Forward
0 new messages