Skip to contents

Scenarios illustrate a concrete example of a specific behavior.

Usage

scenario(title, given, when, then, and = NULL)

Arguments

title

Scenario title

given

Preconditions or initial context

when

An action occurs

then

The expected outcome or behavior

and

additional 'and' arguments

Value

A scenario (based on Gherkin syntax)

Keywords

Scenarios include 'Given', 'When', and 'Then' keywords (and sometimes additional 'And' statements).

See also

feature()

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

Examples

scenario(
    title = "Split column with a default pattern",
    given = "a dataframe with a specified column [name]",
    when = "I split the [name] column using the default [pattern]",
    then = "Then the [name] column should be split into multiple columns",
    and = "the new columns should be named with the default prefix [cols]"
  )
#> Scenario: Split column with a default pattern
#>   Given a dataframe with a specified column [name]
#>   When I split the [name] column using the default [pattern]
#>   Then Then the [name] column should be split into multiple columns
#>   And the new columns should be named with the default prefix [cols]