Thursday, November 27, 2008

Take your system for a SWiM

Marcus Ahnve voiced some intresting thoughts about 'should' and BDD in his post "Words dont come easy: MoSCov and BDD". Here's a few follow-up thoughts.

Since we write tests mainly for two reasons, to validate that we built something right, and often even more important, that we built the right thing. We often seek answers along the lines of, how does this class or compononent work? How do I use it? What precondition must be fullfilled? In short, we want answers.

I propse we learn our tests to SWiM!

S(hould)

The SUT should do something, the core of BDD. "The index page SHOULD have the title...". Great for starting conversations, discussion friendly since it's a quite soft expression that's easy to question with a simple "should it really?".

W(on't)

The SUT simply shouldn't do this. "Reading the same item twice WON'T cause multiple database calls." Good for thoose "Should not" moments.

i(nstruct)

How do I use this component? Learning tests, code samples and the like qualify. Capturing small scenarios as tests can be a nice way to spread knowledge on how to use the SUT, show best practice's and document often raised questions.

M(ust)

The SUT must always do this, "Authentication MUST fail if given the wrong username and password".

As Marcus points out in his comments "BDD is all about conversation" good conversations need strong and shared vocabularies.

3 comments:

  1. Since it's been asked "SUT" == "System Under Test" basicly the thing we're testing, could be a function, a class or a complete system.

    ReplyDelete
  2. Good post!
    It feels like the development culture is somewhere in the beginning of learning. Yet again after all these years. We are getting our selfs some tools to learn "how to do our work". All these abbreviations YAGNI, MoSCoW, BDD/TDD, SWiM etc. feel exactly when my brothers 6 year old daughter is learning the alphabet with string of words; A for an Ape, B for a Banana etc.
    I think we are on the brink of something here, the community is trying to stand up!

    ReplyDelete
  3. Maybe we're in the middle of the "Cambrian explosion of acronyms"! ;)

    There's something very compelling with the notation that the developer community is actually starting to mature into... Reading and Writing!
    Basicly establishing the skills needed to communicate across space and time.

    ReplyDelete