Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sebastian Bergmann's Blog:
Generating Code from Tests
Mar 13, 2008 @ 13: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.
tagged: phpunit generate unittest testfirst programming

Link:

Paul Jones' Blog:
TDD, Test-First, and Ravioli Code
Jul 18, 2007 @ 13:43:00

With test-driven development being promoted as one thing that can help encourage better coding, most developers are looking into its use and how it can help. Paul Jones takes an opposite approach, though, and looks at how it could cause "ravioli code" in an application.

I know that test-first and test-driven development (TDD) are popular methodologies these days, but something about those processes has always met with a level of mental resistance from me. Even though it sounds good in theory, I have been intuitively wary of the "test-first" mentality for some reason. My own approach is closer "remember to code so you can test it later" and then "test-last" after the API is mostly stable.

He includes quotes from Slashdot comment quotes from AuMatar and dkf. Be sure to check out the comments on the post (17 of them at the time of this posting) for some opinions from others about test-driven development and how it can affect your code.

Blogs also mentioning this discussion:

tagged: raviloi testdriven development testfirst raviloi testdriven development testfirst

Link:

Paul Jones' Blog:
TDD, Test-First, and Ravioli Code
Jul 18, 2007 @ 13:43:00

With test-driven development being promoted as one thing that can help encourage better coding, most developers are looking into its use and how it can help. Paul Jones takes an opposite approach, though, and looks at how it could cause "ravioli code" in an application.

I know that test-first and test-driven development (TDD) are popular methodologies these days, but something about those processes has always met with a level of mental resistance from me. Even though it sounds good in theory, I have been intuitively wary of the "test-first" mentality for some reason. My own approach is closer "remember to code so you can test it later" and then "test-last" after the API is mostly stable.

He includes quotes from Slashdot comment quotes from AuMatar and dkf. Be sure to check out the comments on the post (17 of them at the time of this posting) for some opinions from others about test-driven development and how it can affect your code.

Blogs also mentioning this discussion:

tagged: raviloi testdriven development testfirst raviloi testdriven development testfirst

Link:


Trending Topics: