Crazy like a fox.

At my current client, everyone loves BDD, and everyone starts their tests with the word ‘should’, describing the behaviour of the associated class. I’m currently looking at this code:

public class PrimaryMixingIteratorTest extends EasyMockObjectTestBase{
    public void testShouldIterateLikeAFox() throws Exception {
public class SecondaryMixingIteratorTest extends EasyMockObjectTestBase{
    public void testShouldIterateLikeABadger() throws Exception {

Once I’ve remembered how foxes and badgers iterate, this code might make more sense to me. Remind me to run that ‘should is not a silver bullet’ brown bag soon…

Update: If you tied a fox and a badger together and dropped them into the corner of a square pond, they’d make a splash. Imagine that splashes happened in squares instead of circles, and that the quarter of the concentric square formed by the fox and badger started at the top-right then went to the bottom-right then bottom-left. Now imagine that the fox shouts out which row the splash happens in, and the badger shouts out the columns.

It’s a way of combining the values of two infinitely-sized lists for an arbitrary number of combinations, without loading the lists into memory. Makes so much more sense. Hold on, I’m getting a phone call from the RSPCA…

This entry was posted in bdd and tagged . Bookmark the permalink.

2 Responses to Crazy like a fox.

  1. anonymous says:

    Much love for the Splash metaphore… just wish that ‘iterate like a badger’ meant something to people other than me! šŸ˜‰

  2. anonymous says:

    I find it helps if you strongly suggest that test class names begin with the word When.

    public class WhenStackIsEmpty
    public void PopShouldThrowAnException()

Comments are closed.