FOSDEM, Bruxelles, 2005
Technical debt is a measure of how untidy or out-of-date the development work area for a product is. It builds up to create legacy code.
Is your code easy to change? Can you get nearly instantaneous feedback when you do change it? If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts.
You can invest in tools but these don't add value over time : there's no interest over time.
We value individuals and interactions over processes and tools.
Extract from the Agile Manifesto.
One such area is unit and accpetance tests -- developpers' tests : Kent Beck -- Developer Testing.
Definition of unit test : c2 wiki
Definition of acceptance test (or functionnal test) : c2 wiki
Here's probably what you want to avoid :
Here's probably what automated developer testing can do to you :
Check out other satisfied people.
Confidence and serenity are the magic words here.
You know it works, and you know when it works. So developer testing is good for you.
It may also be a nice way to fight spam at the roots.
Once we eradicate spam about hair loss, we can think of a way of making viagra a thing of the past.
The SimpleTest documentation and tutorial are really good (I know, I have translated them ;-). Exemples come from those : my goal today is to try and convince you reading those...
<?php require_once('simpletest/unit_tester.php'); require_once('simpletest/reporter.php'); require_once('../classes/log.php'); class TestOfLogging extends UnitTestCase { function testCreatingNewFile() { @unlink('/temp/test.log'); $log = new Log('/temp/test.log'); $this->assertFalse(file_exists('/temp/test.log')); } } $test = &new TestOfLogging(); $test->run(new HtmlReporter()); ?>
What do we get?
<?php require_once('simpletest/web_tester.php'); require_once('simpletest/reporter.php'); class TestOfFosdem extends WebTestCase { function setUp() { $this->get('http://fosdem.org/2005/index/dev_room_phppear/schedule'); } function testMyName() { $this->assertWantedPattern('/perrick penet/i'); $this->assertNoUnwantedPattern('/perrick pennet/i'); } } $test = &new TestOfFosdem(); $test->run(new HtmlReporter()); ?>
Once you've written a few test, it may seem tedious at the beginning. Then one day something incredible happen : you modify some code somewhere, then run your test suite and a red bar appears at the other end of your code. You were on the fringe of introducing a new bug and it was discovered automatically. From then on, your investment starts paying back.
You're about to become "test infected".
Writing a test before any code is now your new motto. It has a special rythm to it :
Well actually, it's more something like :
For another such list : Keith Ray.
Right now, there are two active PHP unit testing packages : Pear PHPUnit (Sebastian Bergmann) and SimpleTest (Marcus Baker).
In SimpleTest, you'll find :
The upcoming version (1.1) should bring :
TDD is still a early-starter phenomenon in the PHP World.Its founders come from the OO World -- Java in particular, Ruby also has a built-in unit tester.
Open Source projets using SimpleTest :
Projects with * are listed in the Zend PHP5 contest (Prado came 1st and LIMB 3rd). I'm pretty sure it means something !
Developers's tools using SimpleTest :
http://www.lastcraft.com/simple_test.php
company : No Parking
blog : :: onpk ::
community : AFUP