Pending steps (specification) |
Feature, Scenario, Step |
@name
Feature: A feature |
Pending steps (step definition) |
Library |
library.define('Given a thing') |
Pending steps (runtime) |
Step Implementation |
return { status: BaseStep.PENDING } |
Suggested steps |
MochaPlaybook |
Error: Undefined Step: [Given a thing]
Suggestion:.define('Given a thing', (state) => { // your code here }) |
Report ambiguous steps |
MochaPlaybook |
Error: Ambiguous Step: [Given a thing] is equally matched by signature [/^Given a (\w+)] derived from template [Given a $thing] defined in library [Library One], signature [Given a (\w+)] derived from template [Given a $thang] defined in library [Library Two] |
Ambiguous step resolution (prefer last library) |
Core |
|
Step Expressions (literal) |
Library |
library.define('Given a thing', (state) => { // your code here }) |
Step Expressions (RegExp) |
Library |
library.define(/^Given a (\w+)$/, (state, thing) => { // your code here }) |
Step Expressions (parameterised) |
Library |
library.define('Given a $thing', (state, thing) => { // your code here }) |
Step Expressions (multiple) |
Library |
library.define(['Given a $thing', 'Given an $thing'], (state, thing) => { // your code here }) |
Step Functions (synchronous) |
Library |
library.define('Given a thing', (state) => { // your code here }) |
Step Functions (asynchronous) |
Library |
library.define('Given a thing', async (state) => { // your code here }) |
Step Functions (callback) |
|
|
Parameter conversion (simple) |
Dictionary |
dictionary.define('height', /(\d+)ft/i, new NumberConverter())
library.define('Given $height', async (state, height) => { // your code here }) |
Parameter conversion (DocString) |
|
|
Shared state |
Step Implementation, MochaPlaybook |
(state) => {
state.set('name', 'value', State.FEATURE_SCOPE);
} |