Modify

Ticket #211 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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

Reported by: tbarstow@… Owned by: 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 Download (21.5 KB) - added by tbarstow 4 years ago.
Screenshot

Change History

Changed 4 years ago by tbarstow

Screenshot

comment:1 Changed 4 years ago 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>

comment:2 Changed 4 years ago by mrook

  • Status changed from new to closed
  • Resolution set to fixed

Fix commited in r344.

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.