#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)
Change History (9)
Changed 17 years ago by olle.jonsson@…
comment:1 Changed 17 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 17 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 17 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 17 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.
comment:6 Changed 15 years ago by r.wilczek@…
Added an enhanced and fixed version of my phptools.py at #316
comment:7 Changed 15 years ago by osimons
- Resolution set to fixed
- Status changed from new to closed
diff showing a testcase that phptools can not pass