phpunit producing junit results that junitPublish warns on
I've checked for an answer but haven't found a solution to tweek the phpunit junit results for publishing back to RTC. Or maybe there's a parameter for junitLogPublish.
I have an ant build script calling phpunit with a configuration file to the tests. I call junitLogPublish on the results and see this warning. [exec] Time: 256 ms, Memory: 4.50Mb [exec] [exec] OK (14 tests, 20 assertions) [junitLogPublisher] Non-fatal errors occurred while publishing "/local/scdevlkg/jenkins/workspace/SFA2.0-test/scrm-dataintegration.comp/di.batch/lwp/junit_results/tests-bvt-csvdelta-junit.xml": [junitLogPublisher] Found unexpected element "testsuite" inside element "testsuite". [junitLogPublisher] Found unexpected element "testsuite" inside element "testsuite". [exec] PHPUnit 3.7.28 by Sebastian Bergmann. Here's the junit result. <?xml version="1.0" encoding="UTF-8"?> <testsuites> <testsuite name="SCLoggerTests" tests="3" assertions="3" failures="0" errors="0" time="0.010105"> <testsuite name="CSLoggerTest" file="/local/scdevlkg/jenkins/workspace/SFA2.0-test/scrm-dataintegration.comp/di.batch/lwp/di.batch.test/SCUnitTests/SCLoggerTests/SCLoggerTest.php" tests="3" assertions="3" failures="0" errors="0" time="0.010105"> <testcase name="testPrint" class="CSLoggerTest" file="/local/scdevlkg/jenkins/workspace/SFA2.0-test/scrm-dataintegration.comp/di.batch/lwp/di.batch.test/SCUnitTests/SCLoggerTests/SCLoggerTest.php" line="26" assertions="1" time="0.005086"/> <testcase name="testSetLevel" class="CSLoggerTest" file="/local/scdevlkg/jenkins/workspace/SFA2.0-test/scrm-dataintegration.comp/di.batch/lwp/di.batch.test/SCUnitTests/SCLoggerTests/SCLoggerTest.php" line="32" assertions="1" time="0.001173"/> <testcase name="testPrintCommonLogger" class="CSLoggerTest" file="/local/scdevlkg/jenkins/workspace/SFA2.0-test/scrm-dataintegration.comp/di.batch/lwp/di.batch.test/SCUnitTests/SCLoggerTests/SCLoggerTest.php" line="39" assertions="1" time="0.003846"/> </testsuite> </testsuite> </testsuites> Thanks. |
2 answers
Ralph Schoon (63.4k●3●36●46)
| answered Mar 13 '14, 11:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As far as I know, the build result publishing for the JUnit results depends on the XML structure and data. If your data does not match the JUNIT schema, you can run into problems. You can use XML tooling to modify the data you have to match JUNIT and upload that data.
|
<?xml version="1.0" encoding="UTF-8"?>
Thanks. I was able to eliminate the junit warnings about the outer testsuite and test-case missing classname attribute with this xsl. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="/testsuites"> <testsuites> <xsl:apply-templates select="//testsuite[@file]"/> </testsuites> </xsl:template> <xsl:template match="*"> <xsl:element name="{name()}"> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="@class"> <xsl:attribute name="classname"><xsl:value-of select="."/></xsl:attribute> </xsl:template> <xsl:template match="@*"> <xsl:copy/> </xsl:template> </xsl:stylesheet> |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.