I am using WebdriverIO/Cucumber (wdio-cucumber-framework
) for my test automation. I want to get the test execution result in a HTML file. As of now I am using Spec Reporter (wdio-spec-reporter
). Which helps to print the results in console window. But I want all the execution reports in a HTML file.
How can I get WebdriverIO test execution result in a HTML file?
Thanks.
OK, finally got some spare time to tackle your question @Thangakumar D. WebdriverIO reporting is a vast subject (there are multiple ways to generate such a report), so I'll go ahead and start with my favorite reporter: Allure!
Allure Reporter:
npm install wdio-allure-reporter --save-dev
npm install -g allure-commandline --save-dev
wdio.config.js
file to support Allure as a reporterwdio.config.js:
/allure-results/
folder has been populated with multiple.json
,.txt
,.png
(if you have screenshot errors), and.xml
files. The cotent of this folder is going to be used by Allure CommandLine to render you HTML report./allure-results/
folder and generate the report via:allure generate <reportsFolderPath>
(do it like thisallure generate .
/allure-reports/
folder inside/allure-results/
)/allure-reports
folder and opeindex.html
into your browser of choice (use Firefox for starters)Note: The generated
index.html
file won't have all the content loaded on Chrome unless you do some tweaks. It's due to default WebKit not being able to load all the AJAX calls required. Read more about it here.If you're successfully completed all the previous steps, it should look something like this:
Hope this helped. Cheers!
Note: I'll try to UPDATE this post when I get some more time with other awesome ways to generate reports from your WebdriverIO reporter logs, especially if this post gets some love/upvotes along the way.
e.g.: Another combo that I enjoy using being:
wdio-json-reporter
/wdio-junit-reporter
coupled with a easy-to-use templating language, Jinja2.I have been using Mochawesome reporter and it looks beautiful, check it out here.
Mochawesome reporter generates the mochoawesome.json which then can be used to create a beautiful report using Mochawesome report generator
Installation:
It is easier to integrate by adding this line in the wdio.conf.js:
Add the script to package.json: