Skip to content

Commit

Permalink
Fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alextiley committed Jul 15, 2018
1 parent 9a801b1 commit 4d47241
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
# wdio-cucumber-json-reporter
Cucumber JSON reporter
Generates a JSON report for cucumber via webdriver.io

## About this repo ##

This is a fork of the work previously done by [AlexGalichenko](https://github.com/AlexGalichenko/wdio-cucumber-json-reporter)

I have adapted and added missing properties to the JSON report. It's quite rough around the edges and could definitely do with a tidy up, along with some defensive coding! It was thrown together quickly in order to get nice reporting working via [multiple-cucumber-html-reporter](https://github.com/wswebcreation/multiple-cucumber-html-reporter)
I have adapted and added missing properties to the JSON report. It's quite rough around the edges and could definitely do with a tidy up, along with some defensive coding and tests! It was thrown together quickly in order to get nice reporting working via [multiple-cucumber-html-reporter](https://github.com/wswebcreation/multiple-cucumber-html-reporter)

## Usage ##
`1`. `yarn add wdio-json-cucumber-reporter` or `npm install wdio-json-cucumber-reporter`

`2`. Add 'json-cucumber' to the list of reporters in `wdio.conf.js` and add the following configuration:
1. To install, run `yarn add wdio-json-cucumber-reporter` or `npm install wdio-json-cucumber-reporter`
2. Add `json-cucumber` to the list of reporters in `wdio.conf.js` (see below).
3. Run your tests
4. Added bonus: `yarn add multiple-cucumber-html-reporter` and follow their readme to create a beautiful HTML report.

#### wdio.conf.js ####
```javascript
{
...
reporters: ['json-cucumber'],
...
reporterOptions: {
outputDir: 'some/output/dir',
cucumberJsonReporter: {
silent: true, // true|false - supresses message notifying of report output
baseDir: __dirname, // Should be your project's root directory, used to determine where your feature files are stored
verbose: true, // true|false - set to true for verbose logging
deviceName: 'Local test environment' // Meta data for multiple-cucumber-html-reporter
}
}
...
}
```

`3`. Run your tests

`4`. Added bonus: `yarn add multiple-cucumber-html-reporter` and follow their readme to create a beautiful HTML report.

## Bug reporting ##

Feel free to raise a pull request, or throw me a ticket via the issues section.
Expand All @@ -40,6 +42,5 @@ Feel free to raise a pull request, or throw me a ticket via the issues section.
* Add metadata for test start time, end time and total duration
* Add metadata for feature count, scenario/scenario outline counts and step counts
* Add metadata for failing test count
* Step keyword retrieval is experimental - see if gherkin parser can calculate this for us
* Save report file names based on browser name and timestamp
* Retrieve arguments supplied to each step - doesn't currently look possible
* Retrieve arguments supplied to each step
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wdio-json-cucumber-reporter",
"version": "1.2.0",
"description": "JSON Cucumber reporter",
"description": "Generates a JSON report for cucumber via webdriver.io",
"main": "lib/reporter.js",
"directories": {
"lib": "lib"
Expand Down
2 changes: 1 addition & 1 deletion src/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CucumberJSONReporter extends EventEmitter {
this.jsonBuilder.addMeta({
cid: suite.cid,
browser: suite.runner[suite.cid].browserName,
deviceName: this.options.cucumberJsonReporter.deviceName
deviceName: this.options.cucumberJsonReporter && this.options.cucumberJsonReporter.deviceName
? this.options.cucumberJsonReporter.deviceName
: 'Local test environment'
});
Expand Down

0 comments on commit 4d47241

Please sign in to comment.