Ticket #211 (closed defect: fixed)

Opened 6 months ago

Last modified 5 months ago

XSLT does not handle multiple testcase nodes for the same test method

Reported by: tbarstow@worfklowbydesign.com Assigned to: mrook
Priority: major Milestone: 2.3.1
Component: phing-tasks-phpunit Version: 2.3.0
Keywords: Cc:

Description

Try it out with the following XML:

 <?xml version="1.0" encoding="UTF-8"?>
 <testsuites>
   <testsuite name="DataTest" file="/home/sb/DataTest.php" tests="4"
 failures="1" errors="0" time="0.004322">
     <testcase name="testAdd" class="DataTest" file="/home/sb/DataTest.php"
 line="17" time="0.001042"/>
     <testcase name="testAdd" class="DataTest" file="/home/sb/DataTest.php"
 line="17" time="0.001529"/>
     <testcase name="testAdd" class="DataTest" file="/home/sb/DataTest.php"
 line="17" time="0.000571"/>
     <testcase name="testAdd" class="DataTest" file="/home/sb/DataTest.php"
 line="17" time="0.001180">
       <failure
 type="PHPUnit_Framework_ExpectationFailedException"><![CDATA[testAdd(DataTest)
 with data set #3 (1, 1, 3)
 Failed asserting that <integer:2> matches expected value <integer:3>.

 /home/sb/DataTest.php:19
 ]]></failure>
     </testcase>
   </testsuite>
 </testsuites>

If you use the phpunitreport task on XML like this, the HTML output will not include detail about the testAdd method. No failure message, no backtrace, etc. This isn't because the test failed - the detail is missing for passing tests too - but I noticed it with failing tests because that's when you need the detail ;)

I'm attaching a screenshot to better explain what I mean.

Attachments

Picture 7.png (21.5 kB) - added by tbarstow on 01/14/08 18:12:00.
Screenshot

Change History

01/14/08 18:12:00 changed by tbarstow

  • attachment Picture 7.png added.

Screenshot

01/14/08 21:18:15 changed by tbarstow

I have implemented a "quick fix" to this by passing styledir and forking the XSL stylesheets. The patch that I'm currently using is below. The problem is that phpunit nests testsuite nodes in certain cases, and the XSL stylesheets don't explicitly handle this.

--- /usr/local/php5/lib/php/data/phing/etc/phpunit2-frames.xsl  2008-01-09 13:56:52.000000000 -0500
+++ build/xslt/phpunit2-frames.xsl      2008-01-14 16:12:23.000000000 -0500
@@ -240,7 +240,7 @@
                         <td colspan="4"><xsl:apply-templates select="./error"/></td>
                     </tr>
                 </xsl:if>
-                <xsl:apply-templates select="./testcase" mode="print.test"/>
+                <xsl:apply-templates select="./testcase | ./testsuite/testcase" mode="print.test"/>
             </table>
             <xsl:call-template name="pageFooter"/>
         </body>

01/30/08 19:22:04 changed by mrook

  • status changed from new to closed.
  • resolution set to fixed.

Fix commited in r344.


Add/Change #211 (XSLT does not handle multiple testcase nodes for the same test method)




Action