Feature | Supported By | Examples |
---|---|---|
Language selection | Feature | #language: French Fonctionnalité: Une fonctionnalité |
Annotations (boolean) | Feature, Background, Scenario, Step | @name |
Annotations (key / value) | Feature, Background, Scenario, Step | @name=value |
Annotations (repeated) | Feature, Background, Scenario, Step | @name=one @name=two |
Section titles | Feature, Background, Scenario | Feature: A feature |
DocStrings (explicit) | Background, Scenario | Scenario: A scenario Given a thing --- This is a DocString --- And another thing |
DocStrings (explicit) | Background, Scenario | Scenario: A scenario Given a thing This is a DocString And another thing |
Free form steps | Background, Scenario | Scenario: A scenario Whatever text you like |
Single line comments | All | # A comment |
Block comments | All | ### A block comment ### |
Where: |Height|Width| |------|-----| |10m |3m | |12m |4m | |
Feature | Supported By | Example |
---|---|---|
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 }) |
Parameter conversion (simple) | Dictionary | dictionary.define('height', /(\d+)ft/i, new NumberConverter()) library.define('Given $height', async (state, height) => { // your code here }) |
Shared state | Step Implementation, MochaPlaybook | (state) => { state.set('name', 'value', State.FEATURE_SCOPE); } |
- English
- Pirate
- None
- Boolean
- Date
- List
- Lowercase
- Number
- Uppercase