DEV Community

loading...

What is Given, When Then in agile stories & why ?

sajrashid
・1 min read

Why do we use given, when then

You might be surprised how many engineers, scrum masters and general agile people use given when then, in some form or another, but may not be able to clearly explain why.

A simple user story

Given that I am a user, When I click the update button, Then the button should turn green.

Some may say it makes stories easy to understand, that would be true, but lot's of language styles can do that, so why ?

Ask around ? let us know in the comments

First clue

Given
When
Then

We have three items, where else do we have a similar conceptual flow ?

If you've twigged it already, you're a genius, (yeah I didn't either)

Second clue..

Arrange
Act
Assert

Anyone ?

Map the story to the test

Story Test
Given, that I am user Arrange, test in the context of a user
When, I click the update button Act, create button click test
Then, the button should turn green. Assert, the button colour is actually green

See how the story maps to the test, it makes it crystal clear what the ask is, bearing in mind it's not acceptance criteria it should stay high level.

The developers & the testers are able to break the story down relatively precisely into tasks.

Hopefully you now understand the all encompassing why, at least as far as given when them goes anyway 😮😮😮.

🤚 Bye for now.

Drop me some feedback please, helps decide what to write about next!

Discussion (0)