Sha256: be0897e29916e31126c0e641165746a3bc2a0c3133e0ef058580ab985c1268da

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

# File: demo02.feature

Feature: Show the use of a basic macro with one argument
  As a Cuke user
  So that I enjoy writing scenario.

# The background section is THE good place to define your macros.
# Since the steps from this section are pre-pended to the steps of every scenario (outline),
# the macros will be available to every scenario in the feature file.
Background:
  # The next step creates a macro(-step)
  # The syntax of the new macro-step is specified between the < ... > delimiters.
  # The steps to execute when the macro is used/invoked are listed in the multiline triple quotes arguments.
  # The macro argument is put between double(triple) curly braces {{...}} as required by the Mustache template library.
  Given I define the step <When I [log in as {{userid}}]> to mean:
  """
  Given I landed in the homepage
  When I click "Sign in"
  And I fill in "Username" with "{{userid}}"
  And I fill in "Password" with "unguessable"
  And I click "Submit"
  """

Scenario: Let's use the macro we created above
  # Here the macro is invoked. Actual value for the argument is put between double quotes.
  When I [log in as "guest"]

  # The next step verifies that the steps from the macro were effectively executed.
  Then I expect the following step trace:
  """
Invoked step: ... I landed in the homepage
Invoked step: ... I click "Sign in"
Invoked step: ... I fill in "Username" with "guest"
Invoked step: ... I fill in "Password" with "unguessable"
Invoked step: ... I click "Submit"
  """

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
macros4cuke-0.0.02 features/demo02.feature
macros4cuke-0.0.01 features/demo02.feature