3 ms·
A common anti-pattern with Given-When-Then has the Three Amigoes collaborating on scenarios that are stored as acceptance criteria in user stories. I agree wit
by rgoulter 8y ago
A common anti-pattern with Given-When-Then has the Three Amigoes collaborating on scenarios that are stored as acceptance criteria in user stories.
I agree with this. Writing Cucumber/Gherkin scenarios is extra effort if the Cucumber files themselves aren't used/read elsewhere. -- It'd be simpler to embed "Given/When/Then" statements within test code (like RSpec).
I'd emphasise that Gojko Adzic's "Specification By Example" suggests discussing examples before refining to a specification; that may get around the author's complaint that non-table formats don't allow for important cases.
That said, "Given/When/Then" is hardly magical, so doesn't deserve much praise/criticism itself.
Any test involves "do an action, check the result" (with "setup the system" and "cleanup" being implied). Sometimes called "Assemble, Act, Assert".
"G/W/T" is just a neat, consistent format for describing behaviour in English.
A table of values specifies some computation; the column titles help to describe that behaviour.
- Dangeranger 8y agoYou can embed G/W/T into RSpec. There's a library called Turnip[0], a play on Cucumber, that extends the syntax to Feature tests in RSpec. - [0] https://github.com/jnicklas/turnip https://github.com/jnicklas/turnip The reason RSpec didn't include this originally probably stems from the library being designed for testing at the class or module level, rather than an entire application.