Commit 32ab4849 authored by Ghislain MARY's avatar Ghislain MARY

Add cunit-to-junit.

parent a646cfd8
The MIT License (MIT)
Copyright (c) 2014 Shawn Liang
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# cunit-to-junit
Convert CUnit xml test report to JUnit schema and make it easy to integrate with Jenkins CI xUnit plugin
--
## Purpose
[CUnit](http://cunit.sourceforge.net/) is a uniting framework written in pure C. Like other xUnit framework, CUnit can generate xml test reports. This XSL is able to convert CUnit xml report to popular JUnit schema and makes it easy to integrate CUnit with [Jenkin CI](http://jenkins-ci.org/).
## Use with Jenkins CI
1. Install [xUnit plugin](https://wiki.jenkins-ci.org/display/JENKINS/xUnit+Plugin) to your Jenkins CI
2. Configure project's post build action to "Publish xUnit test result report"
3. Choose "custom tool" as report type
4. Specify CUnit report file pattern
5. Specify the path to <code>cunit-to-junit.xsl</code>
And there you GO!
run
thread apply all bt
quit
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<testsuites>
<xsl:for-each select="//CUNIT_RUN_SUITE_SUCCESS">
<xsl:variable name="suiteName" select="normalize-space(SUITE_NAME/text())"/>
<xsl:variable name="numberOfTests" select="count(CUNIT_RUN_TEST_RECORD/CUNIT_RUN_TEST_SUCCESS)"/>
<xsl:variable name="numberOfFailures" select="count(CUNIT_RUN_TEST_RECORD/CUNIT_RUN_TEST_FAILURE)"/>
<testsuite
name="{$suiteName}"
tests="{$numberOfTests}"
time="0"
failures="{$numberOfFailures}"
errors="0"
skipped="0">
<xsl:for-each select="CUNIT_RUN_TEST_RECORD/CUNIT_RUN_TEST_SUCCESS">
<xsl:variable name="testname" select="normalize-space(TEST_NAME/text())"></xsl:variable>
<testcase classname="{$suiteName}" name="{$testname}" time="0.0">
</testcase>
</xsl:for-each>
<xsl:for-each select="CUNIT_RUN_TEST_RECORD/CUNIT_RUN_TEST_FAILURE">
<xsl:variable name="testname" select="normalize-space(TEST_NAME/text())"></xsl:variable>
<testcase classname="{$suiteName}" name="{$testname}" time="0.0">
<failure>
Test failed at line <xsl:value-of select="LINE_NUMBER"></xsl:value-of> in file <xsl:value-of select="FILE_NAME"></xsl:value-of>: <xsl:value-of select="CONDITION"></xsl:value-of>
</failure>
</testcase>
</xsl:for-each>
</testsuite>
</xsl:for-each>
</testsuites>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment