Consistency gherkins checker for nightwatch-cucumber projects.
Given a folder containing gherkin files (.features
), a consistency test will check if all the steps used in the gherkins will match in your steps definition file.
Install the module in your source folder
npm install gherkin-checker --save
and add it to your scripts
"scripts": {
"gherkin-checker": "gherkin-checker"
}
or install globally
npm install -g gherkin-checker
and in your source folder simply run
gherkin-checker
In the folder where you'll run the module create a file named gherkin-checker.conf.js
if you want to override the default configs.
//default configurations
module.exports = {
features_path: "./features",
steps_path: "./steps/common-steps",
mode: 'full',
components: {
enabled: false,
components_path: "./components/components",
excludedComponents: []
},
reporter: {
type: 'light'
}
}
The folder containing your gherkin files (.features
).
The file containing your steps definitions.
Define the test running mode.
full
: a separate test will be performed for each.feature
file in thefeatures_path
folderlight
: a global test will be performed for all.feature
files in thefeatures_path
folder
Additional components configurations.
If you use a module that exports a list of components used for mapping css-selectors with this structure:
// example: components.js
module.exports {
_components: {
'component1': 'body',
'component2': '.container',
'component3': '.container div',
'component4': '.footer a.link'
}
}
and in your gherkin you have something like this:
#gherkin that uses components
Scenario:
Given I do something
When I click "component1"
Then "component2" is displayed
then you should set components.enable = true
.
Enable additional components support
The file containing your components definition.
Array of components you want to skip in consistency check.
Console reporter configurations.
Define the console report style.
full
: both successful and failed assertions will be shownlight
: only failed assertions will be shown
credits: the reporter is a custom version of tap-diff
you can specify the --path
parameter to change the features_path
option
Usage: gherkin-checker [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --path <path> features folder location (priority over configuration files)
-m, --mode <value> (optional) test mode [full|light])
-r, --report <value> (optional) report style [full|light])