Edgewall Software

Ticket #199 (closed defect: fixed)

Opened 2 years ago

Last modified 6 months ago

PHPUnit integration cannot process nested test suites

Reported by: sb@… Owned by: cmlenz
Priority: major Milestone: 0.6
Component: General Version: 0.5.3
Keywords: PHPUnit Cc: osimons
Operating System: BSD

Description

The PHPUnit integration cannot process nested test suites.

TestSuite.php:

<?php
class OneTest extends PHPUnit_Framework_TestCase
{
    public static function testOne()
    {
    }
}

class TwoTest extends PHPUnit_Framework_TestCase
{
    public static function testTwo()
    {
    }
}

class TestSuite
{
    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('Example TestSuite');

        $suite->addTestSuite('OneTest');
        $suite->addTestSuite('TwoTest');

        return $suite;
    }
}

Generated XML logfile for TestSuite:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="Example TestSuite" tests="2" failures="0" errors="0" time="0.001961">
    <testsuite name="OneTest" file="/home/sb/TestSuite.php" tests="1" failures="0" errors="0" time="0.001021">
      <testcase name="testOne" class="OneTest" file="/home/sb/TestSuite.php" time="0.001021"/>
    </testsuite>
    <testsuite name="TwoTest" file="/home/sb/TestSuite.php" tests="1" failures="0" errors="0" time="0.000940">
      <testcase name="testTwo" class="TwoTest" file="/home/sb/TestSuite.php" time="0.000940"/>
    </testsuite>
  </testsuite>
</testsuites>

Attachments

phptools_nested_xml.diff Download (1.5 KB) - added by olle.jonsson@… 2 years ago.
diff showing a testcase that phptools can not pass
phptools.py Download (4.9 KB) - added by r.wilczek@… 2 years ago.
supporting nested testsuites

Change History

Changed 2 years ago by olle.jonsson@…

diff showing a testcase that phptools can not pass

Changed 2 years ago by r.wilczek@…

Is there any effort taken on this? It really hinders usage of bitten for testdriven PHP-projects.

Changed 2 years ago by olle.jonsson@…

@r.wilczek: Just to explain status on this: phptools is a 3rd-party addition to Bitten, included with the distribution.

I guess it is up to the PHP-using Bitten community to patch this.

Phpunit uses the pattern of nested testsuites, so we'll have to create Bitten support for that, then.

Changed 2 years ago by r.wilczek@…

If it was up to PHP I would really like to support. Alas phptools is written in Python ...

So what we are searching for is a PHP-using Python-programmer ;-)

Changed 2 years ago by r.wilczek@…

phew ... finally tried my hand on Python ... don't blame me for not thinking "pythonish" or "bittenish" - this is my first try with both the language and your API :-)

Here is my version of phptools.py containing a better phpunit-step.

It is basically able to deal with nested testsuites and with XML-logs created by PHPUnit itself.

The idea here is to simply skip the composite-suites and process the leaf-suites only. Thus the bitten-report will look the same and continue feeding those nice diagrams.

I think it does not make sense to have more than that simple table-report in Bitten's build-view. More sophisticated result-viewers should be created separately.

Note: Forget about Phing's phpunit- and phpunitreport-tasks! They are neither able to create correct XML-logs nor to render correct reports. Reason: They do not support nested testsuites! :-))

Use Phing's exec-task instead to invoke phpunit with the correct arguments to create the XML-log.

  • Create the simple Bitten-report by giving that XML-file in your Bitten-recipe <php:phpunit file="results.xml" />
  • Create complex reports out of that log using XSLT or what you like.

Changed 2 years ago by r.wilczek@…

supporting nested testsuites

Changed 7 months ago by osimons

  • cc osimons added

See #316.

Changed 7 months ago by r.wilczek@…

Added an enhanced and fixed version of my phptools.py at #316

Changed 6 months ago by osimons

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

This has been fixed as part of [671], see #316 for all details and discussion.

Add/Change #199 (PHPUnit integration cannot process nested test suites)

Author


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


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.