Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created July 8, 2013 05:38
Show Gist options
  • Select an option

  • Save etorreborre/5946440 to your computer and use it in GitHub Desktop.

Select an option

Save etorreborre/5946440 to your computer and use it in GitHub Desktop.
G/W/T
I'm not a fan of G/W/T because:
- in its original form it forces you to use the words "given/when/then" and I prefer to have more freedom when I write specifications (even if the G/W/T pattern is actually followed)
- the implementation makes it hard not to use variables, leading to difficulties in reusing steps and composing behaviors
- I tend to think of a more simple functional, "input-output" way of seeing things when I write specifications
@YannMoisan
Copy link

Thanks a lot for your answer !

Point 1. I use G/W/T as the equivalent of A/A/A, the pro is the comprehensive and coherent structure of my tests. I've noted the freedom allows by specs2.

Point 2. If I understand well your previous answer, If I want the same behaviour as Around, i have to duplicate preStep and postStep around all my scenarios. -> so yes, this duplication seems to break DRY principle.

Point 3. I'm not yet ready for pure functionnal programming and some output depends on input AND global state (e.g. Database setup)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment