# `Cucumber.StepDefinition`
[🔗](https://github.com/huddlz-hq/cucumber/blob/main/lib/cucumber/step_definition.ex#L1)

Provides macros for defining cucumber step definitions.

## Usage

    defmodule AuthenticationSteps do
      use Cucumber.StepDefinition

      step "I am logged in as {string}", %{args: [username]} = context do
        {:ok, Map.put(context, :current_user, username)}
      end
    end

## Regular expression patterns

Steps can also be defined with a regular expression instead of a cucumber
expression. The regex must match the entire step text, and capture groups
arrive in `context.args` in order — always as strings (no type conversion),
with `nil` for unmatched optional groups:

    step ~r/^I have (\d+) cukes(?: in my (.+))?$/, %{args: [count, location]} = context do
      {:ok, Map.put(context, :cukes, {String.to_integer(count), location})}
    end

# `step`
*macro* 

Defines a step implementation.

The pattern is either a cucumber expression string or a regular expression
(`~r//` sigil) — see the module documentation for the differences.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
