View Source Criterion (Criterion v0.1.0)

A frame work to write unit tests as a list of steps. It can be used to write tests BDD style.

Usage

  1. Define scenarios using the scenario/2 macro.
  2. Inside each scenario, define steps using the step/2 macro.
  3. Steps can be either plain steps or steps with context variables.

Examples

# Define a scenario
scenario "Adding numbers" do
  # Define a step
  step "Addition" do
    assert 1 + 1 == 2
  end

  # Define a step with context
  step "Addition with context", context do
    result = context[:a] + context[:b]
    assert result == 5
  end
end

Summary

Functions

Link to this macro

scenario(description, test_vars \\ Macro.escape(%{}), list)

View Source (macro)