Skip to main content

Cucumber HTML Report

You must be wondering that all we have seen above is actually good for a test or for a couple of tests. But if we run a full test suite, this report is not much useful in that case. On top of that, it is difficult to keep these console output safe for future use.

Pretty format generate the Cucumber test report in the HTML format. It is the most readable report format. You can specify location of report to local or server.

It display Pass, Failed and skipped steps with different colours. It also display error from stack trace.

However, Basic HTML report does not display summary report like how many scenario and steps has been executed and how many of them pass or fail.

For HTML reports, add below line which start with with plugin to you JUnit Runner class:

@CucumberOptions(
		plugin = {"pretty", "html:target/cucumber"},
		features = {"src/test/resources/features"},
		glue={"com.pb.cucumberdemo.stepdefinitions"},
		)

Here target/cucumber is a folder where your HTML report will be stored with name index.html.

Consider Below Feature file

@userflow
Feature: Registration, Login and MyAccount

  Background: 
    Given I am on the homepage
    And I follow "Sign in"

  @regression @testing
  Scenario Outline: Verify Login Functionality
    And I fill "email address" with "<email>"
    And I fill "password1" with "<password>"
    And I click "sign in"
    Then I should see "<heading>" heading

    Examples: 
      | email                     | password | heading         |
      | goswami.tarun77@gmail.com | test1234 | MY ACCOUNT      |
      | wrongusername             | test     | AUTHENTICATION1 |

And below portion of HTML Report after execution of above Scenario outline

cucumber html reporting

Here Passed Steps coloured with Green and failed with Red. Sky blue colour is for skipped scenarios. You can also see error is also displayed.

Submitted by tgoswami on August 30, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.