Behat/Behat — Issue #64: feature: Background Outline
Author: 2upmedia
Created: 2011-10-26 19:36:54+00:00
State: open

Having a Background Outline to test different variations of a given action or state would be great, that way you could cut down on some of the duplication that needs to be done now since Background Outline doesn't exist.

Example:

```
Feature: Sessions
In order to query the API
As a user
I need to have a valid session

Scenario Outline: Session header is sent and has to be valid
# Internal Fuel URI is not the public URI, but it's the only way to fake a URI in Fuel internally.
When I do a request on "" via ""
Given a Session HREF of ""
Then hasValidSession Method should return ""

Examples:
| Internal Fuel URI	| HTTP Method	| Session HREF	| hasValidSession Boolean	|
| /sessions/post_index	| POST	| /sessions/abcdef	| TRUE	|
| /sessions/get_index	| GET	| /sessions/abcdef	| TRUE	|
| /sessions/update_index	| UPDATE	| /sessions/abcdef	| TRUE	|
| /sessions/delete_index	| DELETE	| /sessions/abcdef	| TRUE	|
|	|	| /sessions/zyxwvu	| FALSE	|
```

Can be changed to:

```
Feature: Sessions
In order to query the API
As a user
I need to have a valid session

Background Outline:
When I do a request on "" via ""

Examples:
| Internal Fuel URI	| HTTP Method	|
| /sessions/post_index	| POST	|
| /sessions/get_index	| GET	|
| /sessions/update_index	| UPDATE	|
| /sessions/delete_index	| DELETE	|
|	|	|

Scenario Outline: Session header is sent and has to be valid
# Internal Fuel URI is not the public URI, but it's the only way to fake a URI in Fuel internally.
When I do a request on "" via ""
Given a Session HREF of ""
Then hasValidSession Method should return ""

Examples:
| Session HREF	| hasValidSession Boolean	|
| /sessions/abcdef	| TRUE	|
| /sessions/abcdef	| TRUE	|
| /sessions/abcdef	| TRUE	|
| /sessions/abcdef	| TRUE	|
| /sessions/zyxwvu	| FALSE	|
```

Each Background Example will run once before each Scenario/Scenario Outline.

P.S. There's a reason why I used When, Given, Then instead of Given, When, Then.