| Exploring Solution Spaces © Copyright 2003-2006, by C. Keith Ray | ||||||||||||||||||||||||
|
Archives
Subscribe |
2008.Jun.09 Mon
Don't Let Your Programmer Tests Turn Into Fairy Tales
Maybe you start out with:
void testLittleRedRidingHood()
{
LittleGirl child = new LittleRedRidingHood();
assertTrue(child.hasHood());
}
but then you add something more
void testLittleRedRidingHood()
{
LittleGirl child = new LittleRedRidingHood();
assertTrue(child.hasHood());
assertTrue(child.hasBasket());
Basket basket = child.getBasket();
assertTrue(basket.hasGoodies());
// we're kind of drifting away from LittleRedRidingHood now...
}
and more
void testLittleRedRidingHood()
{
LittleGirl child = new LittleRedRidingHood();
assertTrue(child.hasHood());
assertTrue(child.hasBasket());
Basket basket = child.getBasket();
assertTrue(basket.hasGoodies());
Wolf wolf = new BigBadWolf();
// now we're really going astray...
assertTrue(wolf.hasBigTeeth());
}
If your programmer test (a.k.a. "unit test") is telling a long story, it's probably is too long, not focused enough. Step Into Your Agile Groove With Industrial Logic’s Greatest Hits |
|||||||||||||||||||||||