News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
Sebastian Bergmann's Blog:
Generating Code from Tests
March 13, 2008 @ 08:43:50

Sebastian Bergmann has posted a quick example of how to use the PHPUnit unit testing suite for PHP to create code for you (assuming you're using the test first method of development.

His example builds the class off of a set of test for a "BowlingGame" that ends up with roll() and score() methods based off of the naming conventions used in the test:

Following the convention that the tests for a class BowlingGame (see below) are written in a class named BowlingGameTest (see above), the test case class' source is searched for variables that reference objects of the BowlingGame class and analyzing what methods are called on these objects.
0 comments voice your opinion now!
phpunit generate code unittest testfirst programming



Similar Posts

Richard Davey\'s Blog: $_LIFE - Release regularly, release often (the webcomic)

New Earth Online: Detecting Users Online

Jacob Santos' Blog: What is your C.R.A.P. Index?

DevShed: Design Patterns and PHP 5

Sebastian Bergmann's Blog: Distributed Testing with PHPUnit 3.1


Community Events







Don't see your event here?
Let us know!


release PHP5 application security zendframework developer example book PEAR package ajax job code zend database releases mysql framework conference cakephp

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework