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:
reporters: ['allure', 'dot', 'spec', 'json'],
reporterOptions: {
outputDir: './wdio-logs/',
allure: {
outputDir: './allure-reports/allure/'
}
}
/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 this allure generate .
/allure-reports/
folder inside /allure-results/
)/allure-reports
folder and ope index.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With