I'm using plunit
package for my prolog unit tests (SWI-Prolog 7.2).
run_tests/0
prints the results on console but I would like to export plunit test results in the xUnit XML format that most CI servers understand. Is there any way for this ?
I'm using plunit
package for my prolog unit tests (SWI-Prolog 7.2).
run_tests/0
prints the results on console but I would like to export plunit test results in the xUnit XML format that most CI servers understand. Is there any way for this ?
I assume that SWI-Prolog plunit
tool uses the message printing mechanism to generate its output. If true, you should be able to export unit test results in the xUnit XML format (or any other format) by intercepting those messages using the message_hook/3
predicate:
http://www.swi-prolog.org/pldoc/doc_for?object=message_hook/3
By coincidence, I'm working in similar support (for exporting testing results) for Logtalk's unit testing tool, lgtunit
. It should give you an idea on how to do it for plunit
. I committed a preliminary version today:
https://github.com/LogtalkDotOrg/logtalk3/blob/master/tools/lgtunit/NOTES.md https://github.com/LogtalkDotOrg/logtalk3/blob/master/tools/lgtunit/xunit_xml_report.lgt
In my case, this support is being targeted for integration with the CI server Concourse. There seems to be, unfortunately, a lack of definitive information on the xUnit XML format with sources quoting different versions of e.g. which attributes are required or optional. I did find a XSD for this format bit I have no idea of its accuracy or if it's just another variation: