Gwen CLI
Command line interface
Since v1.0.0
Options and usage
All launch operations can be invoked using the Gwen CLI. To list the usage and all available options, invoke Gwen with only the --help
switch. The following output will be displayed:
Usage: gwen [options] [files|dirs]
--version Print Gwen version
--help Print CLI usage
--parallel Execute features or scenarios in parallel
- features if gwen.state.level = feature (default)
- scenarios if gwen.state.level = scenario
-b, --batch Exit when execution completes (omit to open REPL)
-v, --verbose Enable verbose log output
-d, --debug Enable breakpoints and interactive debugging
-n, --dry-run Check all syntax and bindings and report errors
-c, --conf files Settings files: conf, json or properties (comma separated)
-p, --properties files Properties files (deprecated, use -c|--conf instead)
-r, --report dir Directory to output generated report(s) to
-f, --formats reports Report formats to include in output (comma separated)
- html,junit,json,rp,none (default = html, rp deprecated)
-t, --tags filter Tags to @include or ~@exclude (comma separated)
-i, --input-data file Input data feed (csv or json file)
-m, --meta files|dirs Meta files or directories to load (comma separated)
files|dirs Feature files or directories to execute (space separated)
Command: init [dir]
Initialise project directory
dir Project directory to initialise (default is gwen)
--docker Generate files in project for running Gwen in Docker
--jenkins Generate files in project for running Gwen on Jenkins
--force Regenerate and overwrite previously initialised files
Command: format files|dirs
Format feature and meta files
files|dirs Feature/meta files or dirs to format (space separated)
--pretty Pretty Gherkin format (default)
Environment variables
The following environment variables can be set to override certain settings as below:
Since | Environment variable | Values | Overrides setting | Affects CLI option |
---|---|---|---|---|
v3.16.0 | GWEN_BROWSER | chrome|edge| firefox|safari|ie | gwen.target.browser | |
v3.23.0 | GWEN_ENV | local|dev| test|staging| prod|.. | gwen.target.env | |
v3.16.0 | GWEN_DRY_RUN | true|false | gwen.cli.options.dryRun | -n, --dry-run |
v3.16.0 | GWEN_PARALLEL | true|false | gwen.cli.options.parallel | --parallel |
v3.18.0 | GWEN_THREADS | auto|number | gwen.parallel.maxThreads | |
v3.16.0 | GWEN_HEADLESS | true|false | gwen.web.browser.headless | |
v3.18.0 | GWEN_VIDEO | true|false | selenoid:options.enableVideo | |
v3.71.3 | GWEN_WEB_VERSION | Version or Semver range (Overrides Gwen web version in package.json) |
System properties and JVM options
In addition to the above, you can also pass any number of Java system properties or JVM options to the CLI:
-Dprop.name=value
- To pass a system property to the Java process that runs Gwen
- Will override any same named Gwen setting
- Will be picked up by
${prop.name}
placeholders in feature and meta specs
-J<JVM_OPTION>
- To pass a JVM option to the Java process that runs Gwen
- The
-J
prefix will be stripped and<JVM_OPTION>
will be passed through
The enviornment variable overrides in the previous section however do have precedence over these.
Configurable CLI options
Since Gwen 3
CLI options can be configured in settings enabling you to customize your own launch profile (excluding --version
and --help
).
CLI reference
Options
--version
Optional switch for outputting the Gwen version.
--version
--help
Optional switch for outputting CLI usage.
--help
Usage
- Project
- Standalone
- Yarn
- npm
- pnpm
yarn gwen --help
npm run gwen -- --help
pnpm gwen --help
gwen --help
Output
__ ___ _____ _ __ _
/ _` \ \ /\ / / _ \ '_ \ { \,"
| (_| |\ V V / __/ | | | {_`/
\__, | \_/\_/ \___|_| |_| `
|___/
Welcome to gwen-web v3.0.0
gweninterpreter.org
Usage: gwen [init] [options] <args>...
--version Print Gwen version
--help Print CLI usage
--parallel Execute features or scenarios in parallel
- features if gwen.state.level = feature (default)
- scenarios if gwen.state.level = scenario
-b, --batch Exit when execution completes (omit to open REPL)
-v, --verbose Enable verbose log output
-n, --dry-run Check all syntax and bindings and report errors
-c, --conf files Settings files: conf, json or properties (comma separated)
-p, --properties files Properties files (deprecated, use -c|--conf instead)
-r, --report dir Directory to output generated report(s) to
-f, --formats reports Report formats to include in output (comma separated)
- html,junit,json,rp,none (default is html)
-t, --tags filter Tags to @include or ~@exclude (comma separated)
-i, --input-data file Input data feed (csv or json file)
-m, --meta files|dirs Meta files or directories to load (comma separated)
files|dirs Feature files or directories to execute (space separated)
Command: init [dir]
Initialise project directory
dir Project directory to initialise (default is gwen)
--docker Generate files in project for running Gwen in Docker
--jenkins Generate files in project for running Gwen on Jenkins
--force Regenerate and overwrite previously initialised files
Command: format files|dirs
Format feature and meta files
files|dirs Feature/meta files or dirs to format (space separated)
--pretty Pretty Gherkin format (default)
--parallel
Optional switch for executing features or scenarios in parallel (one per CPU core) depending on the configured state level. Omit to execute sequentially.
--parallel
Will utilise all avaialable CPU cores unless gwen.parallel.maxThreads
is configured with an explicit maximum.
Examples
- Features
- Scenarios
Features will run in parallel (one per CPU core) when the parallel switch is provided and gwen.state.level
is feature
- Project
- Standalone
- Yarn
- npm
- pnpm
Provide parallel switch to execute all feature files in a given directory in parallel
yarn gwen -b --parallel gwen/features/dir
Provide parallel switch to execute the given feature files in parallel
yarn gwen -b --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all feature files in a given directory in sequence
yarn gwen -b gwen/features/dir
Omit parallel switch to execute the given feature files in sequence
yarn gwen -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all feature files in a given directory in parallel
npm run gwen -- -b --parallel gwen/features/dir
Provide parallel switch to execute the given feature files in parallel
npm run gwen -- --batch --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all feature files in a given directory in sequence
npm run gwen -- -b gwen/features/dir
Omit parallel switch to execute the given feature files in sequence
npm run gwen -- -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all feature files in a given directory in parallel
pnpm gwen -b --parallel gwen/features/dir
Provide parallel switch to execute the given feature files in parallel
pnpm gwen -b --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all feature files in a given directory in sequence
pnpm gwen -b gwen/features/dir
Omit parallel switch to execute the given feature files in sequence
pnpm gwen -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all feature files in a given directory in parallel
gwen -b --parallel features/dir
Provide parallel switch to execute the given feature files in parallel
gwen -b --parallel features/file1.feature features/file2.feature
Omit parallel switch to execute all feature files in a given directory in sequence
gwen -b features/dir
Omit parallel switch to execute the given feature files in sequence
gwen -b features/file1.feature features/file2.feature
Scenarios will run in parallel (one per CPU core) when the parallel switch is provided and gwen.state.level
is scenario
- Project
- Standalone
- Yarn
- npm
- pnpm
Provide parallel switch to execute all scenarios in all feature files in a given directory in parallel
yarn gwen -b --parallel gwen/features/dir
Provide parallel switch to execute all scenarios in the given feature files in parallel
yarn gwen -b --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all scenarios in all feature files in a given directory in sequence
yarn -b gwen/features/dir
Omit parallel switch to execute all scenarios in the given feature files in sequence
yarn -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all scenarios in all feature files in a given directory in parallel
npm run gwen -- -b --parallel gwen/features/dir
Provide parallel switch to execute all scenarios in the given feature files in parallel
npm run gwen -- -b --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all scenarios in all feature files in a given directory in sequence
npm run gwen -- -b gwen/features/dir
Omit parallel switch to execute all scenarios in the given feature files in sequence
npm run gwen -- -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all scenarios in all feature files in a given directory in parallel
pnpm gwen -b --parallel gwen/features/dir
Provide parallel switch to execute all scenarios in the given feature files in parallel
pnpm gwen -b --parallel gwen/features/file1.feature gwen/features/file2.feature
Omit parallel switch to execute all scenarios in all feature files in a given directory in sequence
pnpm -b gwen/features/dir
Omit parallel switch to execute all scenarios in the given feature files in sequence
pnpm -b gwen/features/file1.feature gwen/features/file2.feature
Provide parallel switch to execute all scenarios in all feature files in a given directory in parallel
gwen -b --parallel features/dir
Provide parallel switch to execute all scenarios in the given feature files in parallel
gwen -b --parallel features/file1.feature features/file2.feature
Omit parallel switch to execute all scenarios in all feature files in a given directory in sequence
gwen -b features/dir
Omit parallel switch to execute all scenarios in the given feature files in sequence
gwen -b features/file1.feature features/file2.feature
-b|--batch
Optional switch to execute features and then exit immediately (batch mode). Omit to open REPL instead of exiting (interactive mode).
-b|--batch
Where
Option name is either:
-b
for shorthand--batch
for longhand
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
Provide batch switch to execute all feature files in a given directory and then exit
yarn gwen -b gwen/features/dir
Provide batch switch to execute the given feature file and then exit
yarn gwen --batch gwen/features/file.feature
Omit batch switch to execute the given feature file and then open the REPL
yarn gwen gwen/features/file.feature
Omit batch switch to open the REPL immediately without executing anything
yarn gwen
Provide batch switch to execute all feature files in a given directory and then exit
npm run gwen -- -b gwen/features/dir
Provide batch switch to execute the given feature file and then exit
npm run gwen -- --batch gwen/features/file.feature
Omit batch switch to execute the given feature file and then open the REPL
npm run gwen -- gwen/features/file.feature
Omit batch switch to open the REPL immediately without executing anything
npm run gwen
Provide batch switch to execute all feature files in a given directory and then exit
pnpm gwen -b gwen/features/dir
Provide batch switch to execute the given feature file and then exit
pnpm gwen --batch gwen/features/file.feature
Omit batch switch to execute the given feature file and then open the REPL
pnpm gwen gwen/features/file.feature
Omit batch switch to open the REPL immediately without executing anything
pnpm gwen
Provide batch switch to execute all feature files in a given directory and then exit
gwen -b features/dir
Provide batch switch to execute the given feature file and then exit
gwen --batch features/file.feature
Omit batch switch to execute the given feature file and then open the REPL
gwen features/file.feature
Omit batch switch to open the REPL immediately without executing anything
gwen
-v|--verbose
Optional switch for enabling verbose log output.
-v|--verbose
Where
Option name is either:
-v
for shorthand--verbose
for longhand
Usage
- Project
- Standalone
- Yarn
- npm
- pnpm
yarn gwen -v
Or
yarn gwen --verbose
npm run gwen -- -v
Or
npm run gwen -- --verbose
pnpm gwen -v
Or
pnpm gwen --verbose
gwen -v
Or
gwen --verbose
-d|--debug
Optional switch for enabling breakpoints and debugging.
-d|--debug
Where
Option name is either:
-d
for shorthand--debug
for longhand
Usage
- Project
- Standalone
- Yarn
- npm
- pnpm
yarn gwen -d
Or
yarn gwen --debug
npm run gwen -- -d
Or
npm run gwen -- --debug
pnpm gwen -d
Or
pnpm gwen --debug
gwen -d
Or
gwen --debug
-n|--dry-run
Optional switch to find and report any syntax or binding errors that may exist in your feature and meta files. Use this to validate your feature and meta files before committig to an automation cycle. Omit to execute.
-n|--dry-run
Where
Option name is either:
-n
for shorthand--dry-run
for longhand
Output
- A HTML report highlighting all errors found (if any)
- Errors are also logged to the console
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
Provide dry run switch to find and report any errors in all feature and meta files in a given directory
yarn gwen -b -n gwen/features/dir
Provide dry run switch to find and report any errors in the given feature file and its associative meta
yarn gwen --batch --dry-run gwen/features/file.feature
Provide dry run switch to find and report any errors in all feature and meta files in a given directory
npm run gwen -- -b -n gwen/features/dir
Provide dry run switch to find and report any errors in the given feature file and its associative meta
npm run gwen -- --batch --dry-run gwen/features/file.feature
Provide dry run switch to find and report any errors in all feature and meta files in a given directory
pnpm gwen -b -n gwen/features/dir
Provide dry run switch to find and report any errors in the given feature file and its associative meta
pnpm gwen --batch --dry-run gwen/features/file.feature
Provide dry run switch to find and report any errors in all feature and meta files in a given directory
gwen -b -n features/dir
Provide dry run switch to find and report any errors in the given feature file and its associative meta
gwen --batch --dry-run features/file.feature
-c|--conf <files>
Optional list of settings files to load. These are loaded in the order given with latter entries overriding the former.
-c|--conf <files>
Where
Option name is either:
-c
for shorthand--conf
for longhand
<files>
is a comma separated list of.conf
,.json
, or.properties
settings file paths.
The -p|--properties
option in early version of Gwen has been deprecated and replaced in favor of this option since Gwen 3. The former will still work for properties files until the next major release (and will be removed then). You should use this launch option going forward.
The following settings files are implicity added as defaults:
- Browser settings file if it exists and no other browser settings file is explicitly passed:
gwen.baseDir/browsers/$gwen.target.browser.conf
- Environment settings file if it exists and no other environemnt settings file is explicitly passed:
gwen.baseDir/env/$gwen.target.env.conf
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
To execute all feature files in a directory on the firefox browser using dev environment settings.
yarn gwen -b -c gwen/browsers/firefox.conf,gwen/env/dev.conf gwen/features/dir
To execute a feature file and load custom properties.
yarn gwen --batch --config gwen/props/custom.properties gwen/features/file.feature
To execute all feature files in a directory on the firefox browser using dev environment settings.
npm run gwen -- -b -c gwen/browsers/firefox.conf,gwen/env/dev.conf gwen/features/dir
To execute a feature file and load custom properties.
npm run gwen -- --batch --config gwen/props/custom.properties gwen/features/file.feature
To execute all feature files in a directory on the firefox browser using dev environment settings.
pnpm gwen -b -c gwen/browsers/firefox.conf,gwen/env/dev.conf gwen/features/dir
To execute a feature file and load custom properties.
pnpm gwen --batch --config gwen/props/custom.properties gwen/features/file.feature
To execute all feature files in a directory on the firefox browser using dev environment settings.
gwen -b -c browsers/firefox.conf,env/dev.conf features/dir
To execute a feature file and load custom properties.
gwen --batch --config props/custom.properties features/file.feature
-p|--properties <files>
Optional list of properties files to load. These are loaded in the order given with latter entries overriding the former.
Deprecated since Gwen 3, use -c|--conf
instead.
-p|--properties <files>
-c|--conf
instead.Where
Option name is either:
-p
for shorthand--properties
for longhand
<files>
is a comma separated list of.properties
file paths.
Examples
To execute all feature files in a directory on the firefox browser using dev environment properties.
gwen -b -p browsers/firefox.properties,env/dev.properties features/dir
To execute a feature file and load custom properties.
gwen --batch --properties props/custom.properties features/file.feature
-r|--report <dir>
Optional directory to output generated reports to.
-r|--report <dir>
Where
Option name is either:
-r
for shorthand--report
for longhand
<dir>
is the path to the directory where generated reports will be written to.
Since Gwen 3, HTML reports are generated by default and all reports are written to the output directory defined by the gwen.cli.options.report
setting (which you can change if you wish). You therefore only need to specify this report option if you want to override this default on the CLI for a particular launch. If additionally, you don't want any reports to be generated by default, you can set the gwen.cli.options.format
setting to none
.
Examples
- Gwen 3
- Gwen 2
- Project
- Standalone
- Yarn
- npm
- pnpm
To execute a feature file and output a HTML report to the default output directory
yarn gwen -b gwen/features/file1.feature
To execute all feature files in a directory and output HTML reports to nominated directory
yarn gwen -b --report nominated/outdir gwen/features/dir
To execute a feature file and output a HTML report to the default output directory
npm run gwen -- -b gwen/features/file1.feature
To execute all feature files in a directory and output HTML reports to nominated directory
npm run gwen -- -b --report nominated/outdir gwen/features/dir
To execute a feature file and output a HTML report to the default output directory
pnpm gwen -b gwen/features/file1.feature
To execute all feature files in a directory and output HTML reports to nominated directory
pnpm gwen -b --report nominated/outdir gwen/features/dir
To execute a feature file and output a HTML report to the default output directory
gwen -b features/file1.feature
To execute all feature files in a directory and output HTML reports to nominated directory
gwen -b --report nominated/outdir features/dir
To execute a feature file and output a HTML report to a nominated directory
gwen -b -r nominated/outdir features/file1.feature
To execute all feature files in a directory and output HTML reports to a nominated directory
gwen -b --report nominated/outdir features/dir
-f|--format <reports>
Optional list of report formats to output.
-f|--format <reports>
Where
Option name is either:
-f
for shorthand--format
for longhand
<reports>
is a comma separated list of one or more of the following:html
for HTML reportsjunit
for JUnit-XML reportsjson
for JSON reportsrp
to log results to a Report Portal servernone
for no reports
Since Gwen 3, HTML reports are generated by default and all reports are written to the output directory defined by the gwen.cli.options.report
setting (which you can change if you wish). You therefore no longer need to explictly specify the -r|--report
option with this option unless you want to override the default on the CLI for a particular launch.
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
To
yarn gwen -b gwen/features/dir
To
yarn gwen --batch gwen/features/file.feature
To
npm run gwen -- -b gwen/features/dir
To
npm run gwen -- --batch gwen/features/file.feature
To
pnpm gwen -b gwen/features/dir
To
pnpm gwen --batch gwen/features/file.feature
To
gwen -b features/dir
To
gwen --batch features/file.feature
-i|--input-data <file>
Optional CSV of JSON data feed file.
-i|--input-data <file>
Where
Option name is either:
-i
for shorthand--input-data
for longhand
<file>
is a path to a CSV or JSON data file
See data feeds for more details.
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
To execute all feature files in a directory for every record in a CSV file
yarn gwen -b -i gwen/data/records.csv gwen/features/dir
To execute a feature file for every record in a CSV file
yarn gwen -b --input-data gwen/data/records.csv gwen/features/file.feature
To execute all feature files in a directory for every record in a JSON file (Since v3.47.0)
yarn gwen -b -i gwen/data/records.json gwen/features/dir
To execute a feature file for every record in a JSON file (Since v3.47.0)
yarn gwen -b --input-data gwen/data/records.json gwen/features/file.feature
To execute all feature files in a directory for every record in a CSV file
npm run gwen -- -b -i gwen/data/records.csv gwen/features/dir
To execute a feature file for every record in a CSV file
npm run gwen -- -b --input-data gwen/data/records.csv gwen/features/file.feature
To execute all feature files in a directory for every record in a JSON file (Since v3.47.0)
npm run gwen -- -b -i gwen/data/records.json gwen/features/dir
To execute a feature file for every record in a JSON file (Since v3.47.0)
npm run gwen -- -b --input-data gwen/data/records.json gwen/features/file.feature
To execute all feature files in a directory for every record in a CSV file
pnpm gwen -b -i gwen/data/records.csv gwen/features/dir
To execute a feature file for every record in a CSV file
pnpm gwen -b --input-data gwen/data/records.csv gwen/features/file.feature
To execute all feature files in a directory for every record in a JSON file (Since v3.47.0)
pnpm gwen -b -i gwen/data/records.json gwen/features/dir
To execute a feature file for every record in a JSON file (Since v3.47.0)
pnpm gwen -b --input-data gwen/data/records.json gwen/features/file.feature
To execute all feature files in a directory for every record in a CSV file
gwen -b -i data/records.csv features/dir
To execute a feature file for every record in a CSV file
gwen -b --input-data data/records.csv features/file.feature
To execute all feature files in a directory for every record in a JSON file (Since v3.47.0)
gwen -b -i data/records.json features/dir
To execute a feature file for every record in a JSON file (Since v3.47.0)
gwen -b --input-data data/records.json features/file.feature
-m|--meta <files|dirs>
Optional list of meta files or directories to load.
-m|--meta <files|dirs>
Where
Option name is either:
-m
for shorthand--meta
for longhand
<files|dirs>
is a comma separated list of meta file paths or directories (containing meta files) to load
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
To load all meta files in a directory before executing each feature file in a given directory
yarn gwen -b -m gwen/meta/dir gwen/features/dir
To load a specific meta file before executing a feature file
yarn gwen -b -m gwen/meta/file.meta gwen/features/file.feature
To load all meta files in a directory before executing each feature file in a given directory
npm run gwen -- -b -m gwen/meta/dir gwen/features/dir
To load a specific meta file before executing a feature file
npm run gwen -- -b -m gwen/meta/file.meta gwen/features/file.feature
To load all meta files in a directory before executing each feature file in a given directory
pnpm gwen -b -m gwen/meta/dir gwen/features/dir
To load a specific meta file before executing a feature file
pnpm gwen -b -m gwen/meta/file.meta gwen/features/file.feature
To load all meta files in a directory before executing each feature file in a given directory
gwen -b -m meta/dir features/dir
To load a specific meta file before executing a feature file
gwen -b -m meta/file.meta features/file.feature
Arguments
[files|dirs]
Optional list of feature files or directories to execute (optional).
[files|dirs]
Where
<files|dirs>
is a space separated list of feature files or directories (containing feature files) to execute
Examples
- Project
- Standalone
- Yarn
- npm
- pnpm
To execute all features in two given directories
yarn gwen -b gwen/features/dir1 gwen/features/dir2
To execute two feature files
yarn gwen --batch gwen/features/file1.feature gwen/features/file2.feature
To execute all features in two given directories and another feature file
yarn gwen --batch gwen/features/dir1 gwen/features/dir2 gwen/features/file.feature
To execute all features in two given directories
npm run gwen -- -b gwen/features/dir1 gwen/features/dir2
To execute two feature files
npm run gwen -- --batch gwen/features/file1.feature gwen/features/file2.feature
To execute all features in two given directories and another feature file
npm run gwen -- --batch gwen/features/dir1 gwen/features/dir2 gwen/features/file.feature
To execute all features in two given directories
pnpm gwen -b gwen/features/dir1 gwen/features/dir2
To execute two feature files
pnpm gwen --batch gwen/features/file1.feature gwen/features/file2.feature
To execute all features in two given directories and another feature file
pnpm gwen --batch gwen/features/dir1 gwen/features/dir2 gwen/features/file.feature
To execute all features in two given directories
gwen -b features/dir1 features/dir2
To execute two feature files
gwen --batch features/file1.feature features/file2.feature
To execute all features in two given directories and another feature file
gwen --batch features/dir1 features/dir2 features/file.feature
Init command
init [options] [dir]
Command for initialising Gwen in a project directory.
init [options] [dir]
Where
[options]
Can be one or more space separated switches including:[dir]
is- Defaults to a
gwen
subdirectory in your project if not specified
- Defaults to a
Run this command in your project directory to initialise Gwen in it. You can then start using Gwen in your project.
Example
- Project
- Standalone
- Yarn
- npm
- pnpm
To initialse a Gwen project
yarn gwen init
To initialse a Gwen project
npm run gwen init
To initialse a Gwen project
pnpm gwen init
The init
command will generate the following Gwen files and subdirectories in your project
./ # Project root
├── .gitignore # Git ignore file
├── README.md
├── gwen.conf # Gwen settings file
└── /gwen
├── .gitignore # Git ignore file
├── /browsers # Browser settings
│ ├── chrome.conf
│ ├── edge.conf
│ ├── firefox.conf
│ ├── ie.conf
│ ├── README.md
│ └──safari.conf
├── /env # Environment settings
│ ├── dev.conf
│ ├── local.conf
│ ├── prod.conf
│ ├── README.md
│ └── test.conf
├── /features # Features and associative meta
│ └── README.md
├── /meta # Optional common/reusable meta
│ └── README.md
└── /samples # Sample features and meta
To initialse Gwen in a standalone project directory (be sure to include the trailing dot)
gwen init .
The init
command will generate the following Gwen files and subdirectories in your project
./ # Project root
├── .gitignore # Git ignore file
├── README.md
├── gwen.conf # Gwen settings file
├── /browsers # Browser settings
│ ├── chrome.conf
│ ├── edge.conf
│ ├── firefox.conf
│ ├── ie.conf
│ ├── README.md
│ └── safari.conf
├── /env # Environment settings
│ ├── dev.conf
│ ├── local.conf
│ ├── prod.conf
│ ├── README.md
│ ├── staging.conf
│ └── test.conf
├── /features # Features and associative meta
│ └── README.md
├── /meta # Optional common/reusable meta
│ └── README.md
└── /samples # Sample features and meta
Init options
init --docker [--force] [dir]
Generate all the files in your project required for running Gwen in Docker.
init --docker [--force] [dir]
Where
--force
- Include to regenerate and overwrite any previously generated docker files.
[dir]
is the directory to generate the docker files into- Defaults to the
gwen
subdirectory in your project if not specifed
- Defaults to the
- Yarn
- npm
- pnpm
yarn gwen init --docker
npm run gwen init --docker
pnpm gwen init --docker
The init
command will generate the following files
./ # Project root
└── /gwen
├── .env # Docker env file
├── docker-compose.yml # Docker compose file
├── Dockerfile # Docker image file
└── /browsers # Browser settings
├── browsers.json # Selenoid browsers file
└── selenoid.conf # Selenoid settings
init --jenkins [--force] [dir]
Generate a Jenkins pipeline file for your project (Jenkinfile).
init --jenkins [--force] [dir]
Where
--force
- Include to regenerate and overwrite any previously generated Jenkinsfile.
[dir]
is the directory to generate the Jenkinfile into- Defaults to the
gwen
subdirectory in your project if not specifed
- Defaults to the
- Yarn
- npm
- pnpm
yarn gwen init --jenkins
npm run gwen init --jenkins
pnpm gwen init --jenkins
The init
command will generate the following files
./ # Project root
└── /gwen
└── Jenkinsfile # Jenkins pipeline file
Pretty format command
format --pretty <files|dirs>
Command for formatting feature and meta files for consistent and tidy Gherkin. Pretty formatting involves indenting all Gherkin nodes in a standard manner and removing uncecessary whitespace. Formatted files will be updated in place.
format --pretty <files|dirs>
Where
--pretty
- Is the pretty formatting option (default)
- This is currently the default and only supported formatting option
<files|dirs>
(mandatory) is a space separated list of feature/meta files or directories to format
This command will remove any comment lines you may have in your files. You should restore them manually after running the command if you don't want to lose them.
Example
- Project
- Standalone
- Yarn
- npm
- pnpm
To format all feature and meta files in the current directory
yarn gwen format --pretty .
To format all feature and meta files in a given directory
yarn gwen format --pretty path/to/dir
To format a single feature file
yarn gwen format --pretty path/to/file.feature
To format a single feature file
yarn gwen format --pretty path/to/file.feature
To format a single meta file
yarn gwen format --pretty path/to/file.meta
To format all feature and meta files in the current directory
npm run gwen -- format --pretty .
To format all feature and meta files in a given directory
npm run gwen -- format --pretty path/to/dir
To format a single feature file
npm run gwen -- format --pretty path/to/file.feature
To format a single meta file
npm run gwen -- format --pretty path/to/file.meta
To format all feature and meta files in the current directory
pnpm gwen format --pretty .
To format all feature and meta files in a given directory
pnpm gwen format --pretty path/to/dir
To format a single feature file
pnpm gwen format --pretty path/to/file.feature
To format a single meta file
pnpm gwen format --pretty path/to/file.meta
To format all feature and meta files in the current directory
gwen format --pretty .
To format all feature and meta files in a given directory
gwen format --pretty path/to/dir
To format a single feature file
gwen format --pretty path/to/file.feature
To format a single meta file
gwen format --pretty path/to/file.meta