Principle:Nightwatchjs Nightwatch Cucumber Dependency Setup
| Knowledge Sources | |
|---|---|
| Domains | Testing, BDD, Dependency_Management |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A dependency installation step that adds the Cucumber.js BDD framework alongside an existing test runner to enable Gherkin syntax support.
Description
Cucumber Dependency Setup installs the @cucumber/cucumber package, which provides the Gherkin parser, step definition registration functions (Given, When, Then, Before, After), and test execution engine. This is a prerequisite for BDD-style testing where test scenarios are written in natural language (Gherkin) and mapped to code via step definitions.
Nightwatch integrates with Cucumber as an alternative test runner, replacing its default Mocha-like runner. The Cucumber package must be version 7.3 or higher for compatibility.
Usage
Install this dependency when adopting BDD methodology or when the team wants to write test scenarios in Gherkin natural language format.
Theoretical Basis
BDD dependency setup follows the adapter pattern:
- Core framework (Nightwatch) provides browser automation
- BDD framework (Cucumber) provides Gherkin parsing and step matching
- Integration layer bridges both, making browser commands available in step definitions