Skip to content

Instantly share code, notes, and snippets.

@jendiamond
Last active March 11, 2017 08:01
Show Gist options
  • Select an option

  • Save jendiamond/415fcd115d790268ede17ca90418ca76 to your computer and use it in GitHub Desktop.

Select an option

Save jendiamond/415fcd115d790268ede17ca90418ca76 to your computer and use it in GitHub Desktop.

Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST SHOWS
Then a window pops open

I was expecting it to load inside the app
as does the MENTIONED ON AIR link
and the PODCASTS link


Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST STORIES
Then it loads strangely (a flash of something appears and disappears)

I was expecting it to load inside the app
as does the MENTIONED ON AIR link
and the PODCASTS link


Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST STORIES
Then it loads strangely (a flash of something appears and disappears of the content reloading?)

I was expecting it to load inside the app
as does the MENTIONED ON AIR link
and the PODCASTS link


Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST STORIES
And I click on one of the stories
Then it loads in the main content area
But the format is different and is vey bumped down from the top
I was expecting the content arrangement to be the same.


Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST STORIES OR POPULAR NOW
And I click on VIEW MORE
Then it loads in the main content area
But the format is different and is vey bumped down from the top
I was expecting the content arrangement to be the same.


Given that I am at the URL http://www.marketplace.org/
When I click on the sidebar link LATEST STORIES OR POPULAR NOW
And I click on VIEW MORE
Then it loads in the dame stories that are already listed in main content area
But the format is different and is vey bumped down from the top
I was expecting there to more stories but they are the same.


https://martinfowler.com/bliki/GivenWhenThen.html

The given part describes the state of the world before you begin the behavior you're specifying in this scenario. You can think of it as the pre-conditions to the test.
The when section is that behavior that you're specifying.
Finally the then section describes the changes you expect due to the specified behavior.

Since we're talking about using examples as specifications, it makes sense to show this with an example [2]

Feature: User trades stocks
Scenario: User requests a sell before close of trading
Given I have 100 shares of MSFT stock
And I have 150 shares of APPL stock
And the time is before close of trading

When I ask to sell 20 shares of MSFT stock
 
 Then I should have 80 shares of MSFT stock  
  And I should have 150 shares of APPL stock  
  And a sell order for 20 shares of MSFT stock should have been executed

The Given-When-Then formula is a template intended to guide the writing of acceptance tests for a User Story:

(Given) some context  
(When) some action is carried out  
(Then) a particular set of observable consequences should obtain

An example:

Given my bank account is in credit, and I made no withdrawals recently,
When I attempt to withdraw an amount less than my card's limit,
Then the withdrawal should complete without errors or warnings

Tools such as JBehave, RSpec or Cucumber encourage use of this template, though it can also be used purely as a heuristic irrespective of any tool.

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