HTML reports

So far we have seen how to write features, scenarios, grouping and categorizing them via tags and having the power to execute them from Rubymine and also from command line. Well, all this is good as we seen “Green” and “Red” in command line, however what if we are used to seeing pretty reports HTML style. Maybe non-technical users would prefer analyzing the results at a later time. There are lots of options that Cucumber provides, however I believe html reports are one of the simplest ways to quickly see the results and share it with others.

How do I do it ?

Thankfully, we don’t have to write a HTML reporter (think about TestNG) or install a surefire plugin (maven) or figure out yet another code exercise to have those reports. Think about it. We have all the information (pass or fail) already in green/red being thrown on command line. Shouldn’t we be able to get it saved in html format with a parameter. Yes ! We can

Enable html reports

Add “–format html –out results.html” to the cucumber options in cucumber.yml file

enable_html_reports

That is it !

Now every time we run cucumber , we get a results.html with all the results. A sample results.html is as below.

HTML reports sample

results

results_1

More Reports

There are many other kinds of reports, graphical, pie-charts, bar graphs, colorful reports, however they are more helpful on CI dashboards as part of Continuous Delivery. Hence you can see those described in another section “Cucumber Jenkins Plugins“. The section is part of Frameworks and beyond because there are some additional concepts we need to understand before we talk about all reports.

cucumber_reports_piecharts_failed

cucumber_reports_piecharts_features

project_performance

worst_perform_feature

 

Closing Thoughts:

There are other report options for us like json and when we move to CI server, we have plugins that can read json and produce pie-charts, bar-graphs that can be visually appealing. More when we get to Continuous Test Automation using CI server discussion