News Feed
Sections




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

PHP in Action Blog:
One behavior != one assertion
February 24, 2009 @ 11:13:17

On the PHP in Action blog, despite some agreement with Padraic Brady on his one behavior, one assertion method for writing unit tests, Dagfinn Reiersol still has his reservations.

Pádraic maintains that one assertion per test is a rule that should always be followed unless there is a specific good reason to break it. I prefer it as a guideline, as does Robert C. Martin in the book Clean Code. The reference is not intended as an appeal to authority to "prove" that I'm right. I'm just making the point that I think this reflects the current state of the art, which is not necessarily perfect, of course.

Dagfinn talks about behavior-driven development and illustrates how a two assertions could be combined into one but that the end result "isn't very pretty" - and that's just testing two proterties of a single object. Imagine what would happen if things got more complex.

0 comments voice your opinion now!
unittest behavior assertion reservation opinion padraicbrady


blog comments powered by Disqus

Similar Posts

Marcelo Gornstein's Blog: Unit test your PHP IVR applications with PAGI

Felix Geisendörfer's Blog: Containable 2.0 BETA

Chris Roane's Blog: PHP: Cheap. Easy. Fast. Flexible.

Matthew Weier O'Phinney's Blog: Zend Framework 1.6.0 Preview, or, PHP 4 is Dead

Stuart Herbert: Personal Thoughts On The PSR-3 Log Proposal


Community Events





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


community laravel api code threedevsandamaybe series framework deployment conference list bugfix introduction symfony zendserver language interview podcast tips release development

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