News Feed
Sections




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

Volker Dusch's Blog:
The UNIT in unit testing
March 15, 2012 @ 08:24:03

Volker Dusch has a new post reminding us about what the "unit" part of "unit testing" means - small chunks of testable parts in an application.

What does the word UNIT in unit testing stand for? Think of an answer and read on! So? Did you say "A method! Because we test methods!"? If so let me offer another perspective.

He suggests that, rather than about just the methods in the class, it's more about testing the "observable behaviors" of the class. That is, anything that you could publicly use the class for and have something happen. He gives examples of this shift in focus - calling setValue and evaluating the result versus just calling the class property itself (then calling the method). He also includes a bit about testing behaviors - what happens when my script does [this] and how does that effect the overall class.

When your tests fail but the class "still works" and you need to "fix the tests" the your tests are worth a lot less as they don't really give you that cozy safety net that they should provide you with.
0 comments voice your opinion now!
unit unittesting opinion recommendation behavior method testable


blog comments powered by Disqus

Similar Posts

ThinkPHP Blog: How do you start Scrum for your PHP projects?

The Bakery: Some ideas to organize your CSS files and autoload them in CakePHP

Christian Stocker\'s Blog: Visual Code Coverage with SimpleTest

Martynas Jusevicius' Blog: Method overloading in PHP 5

Wes Shell's Blog: Quicky 1: PHP is Loosely Typed – What does that Mean?


Community Events





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


release install configure series unittest laravel wordpress interview list introduction developer threedevsandamaybe community language api podcast library framework application code

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