bcunit-to-junit.xsl 1.49 KB
Newer Older
Ghislain MARY's avatar
Ghislain MARY committed
1 2 3 4
<?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="/">
Erwan Croze's avatar
Erwan Croze committed
5 6 7 8 9 10 11 12 13 14 15 16 17
	<testsuites>
		<xsl:for-each select="//BCUNIT_RUN_SUITE_SUCCESS">
			<xsl:variable name="suiteName" select="normalize-space(SUITE_NAME/text())"/>
			<xsl:variable name="numberOfTests" select="count(BCUNIT_RUN_TEST_RECORD/BCUNIT_RUN_TEST_SUCCESS)"/>
			<xsl:variable name="numberOfFailures" select="count(BCUNIT_RUN_TEST_RECORD/BCUNIT_RUN_TEST_FAILURE)"/>
			<testsuite
			name="{$suiteName}"
			tests="{$numberOfTests}"
			time="0"
			failures="{$numberOfFailures}"
			errors="0"
			skipped="0">

18
			<xsl:for-each select="BCUNIT_RUN_TEST_RECORD/BCUNIT_RUN_TEST_SUCCESS">
Ghislain MARY's avatar
Ghislain MARY committed
19 20 21 22
				<xsl:variable name="testname" select="normalize-space(TEST_NAME/text())"></xsl:variable>
				<testcase classname="{$suiteName}" name="{$testname}" time="0.0">
				</testcase>
			</xsl:for-each>
Erwan Croze's avatar
Erwan Croze committed
23

24
			<xsl:for-each select="BCUNIT_RUN_TEST_RECORD/BCUNIT_RUN_TEST_FAILURE">
Ghislain MARY's avatar
Ghislain MARY committed
25 26 27 28 29 30 31
				<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>
Erwan Croze's avatar
Erwan Croze committed
32 33 34
			</testsuite>
		</xsl:for-each>
	</testsuites>
Ghislain MARY's avatar
Ghislain MARY committed
35 36
</xsl:template>
</xsl:stylesheet>