Skip to contents

BDD backgrounds provide context and pre-existing conditions for features and scenarios.

Usage

background(title, given, ...)

Arguments

title

Background title

given

Preconditions for scenario/feature.

...

additional and arguments for initial context (provided in a list())

Value

A BDD background (based on Gherkin syntax)

Technical details

Use background() to reduce repetitive information in scenarios or features.

See also

Other "BDD helpers": feature(), scenario()

Examples

background(title = "Launching the application",
           given = "I have launched the application")
#> Background: Launching the application
#>   Given I have launched the application
background(title = "Launching the application",
           given = "I have launched the application",
           and = "it contains movie review data from IMDB and Rotten Tomatoes")
#> Background: Launching the application
#>   Given I have launched the application
#>   And it contains movie review data from IMDB and Rotten Tomatoes
background(title = "Launching the application",
           given = "I have launched the application",
           and = list("it contains movie review data from IMDB and Rotten Tomatoes",
                      "the data contains variables like 'Critics Score' and 'MPAA'",
                      "the data contains variables like 'Audience Score' and 'Genre'"))
#> Background: Launching the application
#>   Given I have launched the application
#>   And it contains movie review data from IMDB and Rotten Tomatoes
#>   And the data contains variables like 'Critics Score' and 'MPAA'
#>   And the data contains variables like 'Audience Score' and 'Genre'
#>