A WebdriverIO plugin. Report results in json format.
There are breaking changes between WDIO v4 and v5 with how custom reporters work. The chart below shows the versions of this reporter and their WDIO compatibility version.
|WDIO Json Reporter||WDIO|
With WDIO v5, reporting has moved from a centralized process to one that is handled by each of the "sessions" spun up for parallel test execution.
This change helped reduce the amount of chatter during WDIO test execution and thus improved performance. The downside is we are no longer able to get a single report for ALL test execution. Consider the following:
2 suites of tests configured to run in 2 browsers:
- WDIO v4: 1 json file with execution results
- WDIO v5: 4 json files with execution results
wdio-json-reporter provides a utility function to merge the multiple json files into a single file. Follow the steps below to take advantage of the utility.
1) Create a small node script
wdio-custom-filename.json is optional, is the parameter is not provided the default value is
2) Call node script from command line and pass 2 arguments
- <RESULTS_DIR>: Directory where results files are written
- <FILE_REGEX>: Regex pattern for finding
wdio-json-reporterresult files in <RESULTS_DIR>. This is necessary because multiple reporters produce
3) As part of a wdio hook
Upon completion, the merge script will output a single json file named
wdio-merged.json in the provided <RESULTS_DIR>
Following code shows the default wdio test runner configuration. Just add
'json' as reporter
to the array. To get some output during the test you can run the WDIO Dot Reporter and the WDIO JSON Reporter at the same time:
If you do not want to print out the mocha epilogue (i.e.
1 passing (5.2s)), you can suppress it:
For more information on WebdriverIO see the homepage.