
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
grunt-cucumberjs
Advanced tools
Runs cucumberjs features and output results in various formats including html.
Runs cucumberjs features and/or scenarios in parallel.
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-cucumberjs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-cucumberjs');
In your project's Gruntfile, add a section named cucumberjs
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
cucumberjs: {
options: {
format: 'html',
output: 'my_report.html',
theme: 'bootstrap'
},
my_features: ['features/feature1.feature', 'features/feature2.feature'],
other_features: {
options: {
output: 'other_report.html'
},
src: ['other_features/feature1.feature', 'other_features/feature2.feature']
}
}
});
If all your feature files are located in the default location of features/
then just leave the feature configuation as an empty array. See following:
cucumberjs: {
options: {
format: 'html',
output: './public/report.html',
theme: 'foundation'
},
features : []
}
#runs all features specified in task
$ grunt cucumberjs
#you can override options via the cli
$ grunt cucumberjs --require=test/functional/step_definitions/ --features=features/myFeature.feature --format=pretty
Type: String
Default: ''
Passes the value as --steps
parameter to cucumber.
Type: String
Default: ''
Passes the value as --require
parameter to cucumber. If an array, each item is passed as a separate --require
parameter.
Use if step_definitions and hooks are NOT in default location of features/step_definitions
Type: String|Array
Default: ''
Passes the value as --tags
parameter to cucumber. If an array, each item is passed as a separate --tags
parameter.
Type: String
Default: 'foundation'
Available: ['foundation', 'bootstrap', 'simple']
Specifies which theme to use for the html report
Type: String
Default: 'features/templates'
Location of your custom templates. Simply name the template the same as the one you are trying to override and grunt-cucumberjs will use it over the default template
Type: String
Default: 'features_report.html'
Type: String
Default: 'html'
Available: ['pretty', 'progress', 'summary', 'html']
Supports multiple formatter.
Type: Array
Available: ['pretty', 'progress', 'summary', 'html']
e.g. formats: ['html', 'pretty']
Enable debug: true
to print pretty console.
Note: html
formatter will provide Json as well as html
report. Multiple formatter is supported for cucumber v@0.8.0 or higher.
Type: Boolean
Default: 'undefined'
Available: ['true', 'false']
A flag to enable Parallel execution.
• You can run Cucumber Features and/or Scenarios Parallel
• `--parallel scenarios` runs scenarios parallel
• By default or `--parallel features` runs features in parallel
For more information visit cucumber-parallel module
Type: Boolean
Default: 'false'
Available: ['true', 'false']
ends the suite after the first failure
it can also be activated without setting options.failFast
and passing --fail-fast
as a grunt task option
Type: Boolean
Default: 'false'
Available: ['true', 'false']
dry-run the suite and provides snippets for pending steps
it can also be activated without setting options.dryRun
and passing --dry-run
as a grunt task option
Type: Boolean
Default: 'false'
Available: ['true', 'false']
A flag to turn console log on or off
Type: Boolean
Default: 'false'
Available: ['true', 'false']
A flag to enabling debugging from IDE like WebStorm. Limitation of this flag is it only does not support the HTML output, yet ;)
Type: String
Default: undefined
Rerun the failed scenarios recorded in the @rerun.txt
file.
To Re-run failed scenarios:
rerun:@rerun.txt
options: {
format: 'rerun:@rerun.txt',
.....
....
}
It will record all the failed scenarios to @rerun.txt
.
Take a look at options.formats
to generate html report
--rerun=path/to/@rerun.txt
grunt optionType: String
Sets the Cucumber Compiler options. It can also be set by passing through command line --compiler
Type: Boolean
Default: 'false'
Available: ['true', 'false']
Reports total number of failed/passed Scenarios in headers if set to true
.
Reports total number of failed/passed Features in headers if set to false
or undefined
.
Type: Boolean
Automatically launch HTML report at the end of test suite
true
: Launch HTML report in the default browser
false
: Do not launch HTML report at the end of test suite
metadata
Type: JSON
(optional)
Default: undefined
Print more data to your report, such as browser info, platform, app info, environments etc. Data can be passed as JSON key-value
pair. Reporter will parse the JSON and will show the Key-Value under Metadata
section on HTML report. Checkout the below preview HTML Report with Metadata.
Pass the Key-Value pair as per your need, as shown in below example,
metadata: {
"App Version":"0.3.2",
"Test Environment": "STAGING",
"Browser": "Chrome 54.0.2840.98",
"Platform": "Windows 10",
"Parallel": "Scenarios",
"Executed": "Remote"
}
Sample pie chart is available at Bootstrap Theme Report with Pie Chart
Two pie charts are displayed on report
Please note that Pie Charts are available only for Bootstrap Theme.
Take a look at cucumber-html-reporter for more information on Attaching ScreenShots, Plain Texts, Pretty JSON to the HTML report
FAQs
Generates documentation from Cucumber features
The npm package grunt-cucumberjs receives a total of 634 weekly downloads. As such, grunt-cucumberjs popularity was classified as not popular.
We found that grunt-cucumberjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.