Principle:Nightwatchjs Nightwatch Cucumber Test Execution
| Knowledge Sources | |
|---|---|
| Domains | Testing, BDD, CLI |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A CLI execution pattern for running Cucumber BDD tests with Nightwatch, supporting tag filtering, parallel execution, and Cucumber-specific formatters.
Description
Cucumber Test Execution runs BDD tests via the Nightwatch CLI with a Cucumber-specific configuration file. The execution pipeline loads the Cucumber runner, discovers feature files, matches steps to definitions, and executes them with the Nightwatch browser integration. Cucumber-specific options like --tags, --format, --dry-run, and --fail-fast are available.
Note that Nightwatch's built-in reporters (JUnit, HTML) are NOT available when using the Cucumber runner. Instead, Cucumber's own formatters (progress, JSON, JUnit) are used.
Usage
Run Cucumber tests from the CLI specifying the Cucumber-specific config file. Use tags to filter scenarios and formatters for output customization.
Theoretical Basis
The Cucumber execution pipeline:
- Load config with test_runner.type = 'cucumber'
- Discover .feature files via feature_path
- Parse Gherkin into scenario objects
- Match steps to registered step definitions
- Execute each step with browser commands
- Format output via Cucumber formatters