"Web Interface" to PHPunit Tests

Web interface to PHPUnit tests?

You can use phing to run a PHPUnitTask and then convert the output with:

  • PHPUnitReport - This task transforms PHPUnit xml reports to HTML using XSLT.

Example:

<phpunitreport infile="reports/testsuites.xml" 
format="frames"
todir="reports/tests"
styledir="/home/phing/etc"/>

See phpunit --help for the various output formats.

The 2.3 version of PHPUnit had a chapter on this, but it is gone for some time now. You might be able to find an old copy with Google somewhere.

Since you mention this is for phpUnderControl: if you are not fixed on that, consider using Jenkins and http://jenkins-php.org.

On a side note: unless we are talking CI servers, most people I know don't use PHPUnit through a web interface. They either just use the command line or their IDE integration.

Graphical/Browser-Based PHP Unit Testing Suite?

SimpleTest does that:

http://www.simpletest.org/en/first_test_tutorial.html

SimpleTest vs PHPunit

This question is quite dated but as it is still getting traffic and answers I though I state my point here again even so I already did it on some other (newer) questions.

I'm really really baffled that SimpleTest still is considered an alternative to phpunit. Maybe i'm just misinformed but as far as I've seen:

  • PHPUnit is the standard; most frameworks use it (like Zend Framework (1&2), Cake, Agavi, even Symfony is dropping their own Framework in Symfony 2 for phpunit).
  • PHPUnit is integrated in every PHP IDE (Eclipse, Netbeans, Zend Stuide, PHPStorm) and works nicely.
  • Simpletest has an eclipse extension for PHP 5.1 (a.k.a. old) and nothing else.
  • PHPUnit works fine with every continuous integration server since it outputs all standard log files for code coverage and test reports.
  • Simpletest does not. While this is not a big problem to start with it will bite you big time once you stop "just testing" and start developing software (Yes that statement is provocative :) Don't take it too seriously).
  • PHPUnit is actively maintained, stable and works great for every codebase, every scenario and every way you want to write your tests.
  • (Subjective) PHPUnit provides much nicer code coverage reports than Simpletest
  • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)
  • Also there are a couple of suggestings for a web interface to phpunit tests.

I've yet to see any argument in favor of SimpleTest. It's not even simpler to install since PHPUnit is available via pear:

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit

and the "first test" looks pretty much the same.

As of PHPUnit 3.7 it's even easier to install it by just using the PHAR Archive

wget http://pear.phpunit.de/get/phpunit.phar
chmod +x phpunit-3.7.6.phar

or for windows just downloading the phar and running:

php phpunit-.phar

or when using the supported composer install ways like

"require-dev": {
"phpunit/phpunit": "3.7.*"
}

to your composer.json.


For everything you want to test PHPUnit will have a solution and you will be able to find help pretty much anywhere (SO, #phpunit irc channel on freenode, pretty much every php developer ;) )

Please correct me if I've stated something wrong or forgot something :)

Overview of PHP Testing tools

Video: http://conference.phpnw.org.uk/phpnw11/schedule/sebastian-bergmann/

Slides: http://www.slideshare.net/sebastian_bergmann/the-php-testers-toolbox-osi-days-2011

It mentions stuff like Atoum which calls its self: "A simple, modern and intuitive unit testing framework for PHP!"



Full disclosure

I've originally written this answer Jan. 2011 where I had no affiliation with any PHP Testing project. Since then I became a contributor to PHPUnit.



Related Topics



Leave a reply



Submit