Living in the Tech Avalanche Generation

A practitioner’s introspective on technology

If you take just one thing from BDD make it this…..

In a word, NAMING! If your going to take just one thing from BDD and apply it to your work I recommend you start with the way BDD practitioners name their tests. Typically you see test names like:

[Test]

public void make_customers_preferred_when_their_purchases_exceed_a_threshold()
{
    //…….test implementation
}

Even if your not using BDD I strongly suggest using the sentence like naming convention as it makes understanding what’s going on in a test library that much quicker and simpler. And, whilst your at it, why not check out BDD and give a framework like NBehave a try.

Share/Save/Bookmark

No comments

The BDD story of the Village Idiot - a weekend distraction.

Fiddling with NBehave, I couldn’t help myself. It’s probably only me who’s laughing though. For those Woody Allen fans who remember the film “Love and Death” and the characters of Old and Young Nehamkin.

[Story()]
[Test()]
public void FirstDumbStory()
{
    Story dumbstory = new Story(“The Dumbest story ever”);

    dumbstory.AsA(“Village Idiot”).IWant(“Fields of Wheat”).
                SoThat(“I can frolic”);
    dumbstory.WithScenario(“I frolic”)
        .Given(“Nice weather”,
            “I can go out”, s => { ; })
        .When(“I am fully fit”,
            “my spirits will be up”, s => { ; })
        .Then(“I have outdoor options”,
            “and I shall play amongst wheat”, s => { ; });
}

produces the following:

Story: The Dumbest story ever

Narrative:

As a Village Idiot

I want Fields of Wheat

So that I can frolic

Scenario 1: I frolic

Given Nice weather: I can go out

When I am fully fit: my spirits will be up

Then I have outdoor options: and I shall play amongst wheat

1 passed, 0 failed, 0 skipped, took 4.52 seconds.

Share/Save/Bookmark

1 comment

« Previous Page

Creative Commons Attribution-ShareAlike 2.5 Australia
Creative Commons Attribution-ShareAlike 2.5 Australia