BDD For All NPM Wrapper
This is a simple NPM wrapper for the BDD For All library, while we work on a NodeJS port.
Please note, since this is a simple wrapper for the JAVA application, you will need JAVA 8 (minimum) in your path.
$ npm install bdd-for-all -g
$ npm install bdd-for-all -g
This program requires a base configuration file and feature file(s) at a minimum to execute. There is a sample in the samples/ of each. For simple run...
Let's start by creating a configuration file...
- Create a file called
Sample.confand paste the following. This provides the URL you'll be hitting for your tests...bddcore}}
Learn more about the configuration options at https://github.com/Accenture/bdd-for-all/blob/develop/docs/CONFIGURATION.md
- Next, we let's create a sample feature file called
Sample.featureFeature: Testing out the basic step definitions for JSONScenario: Domain override (BS1)Given I am a JSON API consumerAnd I am executing test "BS1"When I request GET "/"Then I should get a status code of 200
- Now we can run the command...$ bdd-for-all -Dconfig.file=Sample.conf -p html:reports/html/ -p json:reports/cucumber.json Sample.feature
As we look at the options above we have...
- Path to the configuration file we just created
- Next we use the
-poptions (for plugin) to produce two reports to disk html and json (can be used in your DevOps pipelines)
- Finally we have the path to the feature file, this could even be a directory with multiple files
Command Line Options
There are more options available, you can always get this by running...
$ bdd-for-all -h
We use the cucumber runner command line tool.
Options:--threads COUNT Number of threads to run tests under.Defaults to 1.-g, --glue PATH Where glue code (step definitions, hooksand plugins) are loaded from.-p, --[add-]plugin PLUGIN[:PATH_OR_URL]Register a plugin.Built-in formatter PLUGIN types: junit,html, pretty, progress, json, usage, rerun,testng. Built-in summary PLUGIN types:default_summary, null_summary. PLUGIN canalso be a fully qualified class name, allowingregistration of 3rd party plugins.--add-plugin does not clobber plugins of thattype defined from a different source.-t, --tags TAG_EXPRESSION Only run scenarios tagged with tags matchingTAG_EXPRESSION.-n, --name REGEXP Only run scenarios whose names match REGEXP.-d, --[no-]dry-run Skip execution of glue code.-m, --[no-]monochrome Don't colour terminal output.-s, --[no-]strict Treat undefined and pending steps as errors.--snippets [underscore|camelcase] Naming convention for generated snippets.Defaults to underscore.-v, --version Print version.-h, --help You're looking at it.--i18n LANG List keywords for in a particular languageRun with "--i18n help" to see all languages--junit,OPTION[,OPTION]* Pass the OPTION(s) to the JUnit module.Use --junit,-h or --junit,--help to print theoptions of the JUnit module.-w, --wip Fail if there are any passing scenarios.Feature path examples:<path> Load the files with the extension ".feature"for the directory <path>and its sub directories.<path>/<name>.feature Load the feature file <path>/<name>.featurefrom the file system.classpath:<path>/<name>.feature Load the feature file <path>/<name>.featurefrom the classpath.<path>/<name>.feature:3:9 Load the scenarios on line 3 and line 9 inthe file <path>/<name>.feature.@<path>/<file> Parse <path>/<file> for feature paths generatedby the rerun formatter.
Remember to check out the docs at https://github.com/Accenture/bdd-for-all