Principle:Nightwatchjs Nightwatch Feature File Authoring
| Knowledge Sources | |
|---|---|
| Domains | Testing, BDD, Gherkin |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A specification-by-example pattern using Gherkin natural language syntax to describe application behavior as executable scenarios.
Description
Feature File Authoring uses the Gherkin language to write human-readable test specifications in .feature files. Each file describes a Feature with one or more Scenarios. Scenarios consist of Given (preconditions), When (actions), and Then (expected outcomes) steps. Tags (@tagName) allow filtering scenarios for selective execution.
This approach bridges the communication gap between technical and non-technical team members: product owners write scenarios in natural language, developers implement step definitions, and the scenarios serve as both documentation and executable tests.
Usage
Write feature files for behavior-driven development when scenarios need to be understood by non-technical stakeholders. Place .feature files in the configured feature_path directory.
Theoretical Basis
Gherkin follows the Given-When-Then (GWT) pattern from BDD:
- Given establishes the initial context (preconditions)
- When describes the action or event being tested
- Then specifies the expected outcome
- And/But extends any step with additional conditions