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
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?
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:
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?