Improve this doc

WDIO Mochawesome Reporter

Generates test results in the json formated needed to create Mochawesome reports.

Installation

1
npm install --save wdio-mochawesome-reporter

A dependency will be added to your package.json

1
2
3
4
5
{
"dependencies": {
"wdio-mochawesome-reporter": "^1.0.0"
}
}

Using

Add to the list of reporters.

1
2
3
4
5
6
7
8
9
10
11
// sample wdio.conf.js
module.exports = {
// ...
reporters: ['dot', 'mochawesome'],
reporterOptions: {
outputDir: './', //json file will be written to this directory
mochawesome_filename: 'myfile.json' //will default to wdiomochawesome.json if no name is provided
},

// ...
};

Mochawesome Report Generator

To convert the json generated by this package into a Mochawesome report you will need to use the Mochawesome Report Generator.

In summary…

  • Add the package to your project

    1
    npm install --save mochawesome-report-generator
  • Add a script to your package.json to generate the report

    1
    2
    3
    "scripts": {
    "generateMochawesome":"marge path/to/results.json --reportTitle 'My Project Results'"
    },

1) path/to/results.json = path and name of json file 2) --reportTitle 'My Project Results = unique report title