Edgewall Software
Modify

Opened 12 years ago

Closed 10 years ago

Last modified 7 years ago

#199 closed defect (fixed)

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 (2)

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

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by olle.jonsson@…

diff showing a testcase that phptools can not pass

comment:1 Changed 12 years ago by r.wilczek@…

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

comment:2 Changed 11 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.

comment:3 Changed 11 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 ;-)

comment:4 Changed 11 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 11 years ago by r.wilczek@…

supporting nested testsuites

comment:5 Changed 10 years ago by osimons

  • Cc osimons added

See #316.

comment:6 Changed 10 years ago by r.wilczek@…

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

comment:7 Changed 10 years ago by osimons

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

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain cmlenz.
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.