You are currently viewing Creating Allure Report With Cucumber – Easy Steps
Allure report

Creating Allure Report With Cucumber – Easy Steps

Spread the love

Allure report with cucumber java | Cucumber is a popular BDD (Behavior-Driven Development) framework that allows you to write tests in a human-readable format. While Cucumber offers powerful testing capabilities, customized test reports can lack visual appeal and detailed insights. Allure is a versatile reporting tool that interfaces seamlessly with Cucumber, allowing you to create visually stunning and informative test reports. In this guide, we will explore how to integrate Allure reports with Cucumber using Java.

Adding Allure reports to Cucumber in a Java project requires a few steps. Allure is a simple and powerful reporting tool that can enhance the visualization of your Cucumber test results. Here’s how you can integrate Allure with Cucumber in a Java project:


Before we jump into the integration process, ensure you have the following in place:

  1. A Java project with Cucumber tests is already set up.
  2. Dependencies for both Cucumber and Allure added to your project (as mentioned in the guide).

Allure framework installation steps:

Start by adding required dependencies like allure-cucumber-jvm etc…




                    -Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"


// Gradle
implementation 'io.qameta.allure:allure-cucumber5-jvm:2.17.3' // Latest version

Then execute mvn clean test goal. After tests executed allure JSON files will be
placed in allure-results directory by default.


This adapter provides runtime integration allowing conversion of Gherkin dsl features into basic Allure features

Display Name

Titles for tests and suites are extracted at runtime from .feature files


Feature’s description appears on every scenario


All scenario steps are automatically translated into allure steps

Adding Attachments

You can simply add an attachment in java code by annotating the method with @Attachment that returns either a String or byte[],

import io.qameta.allure.Attachment;


public String performedActions(ActionSequence actionSequence) {
    return actionSequence.toString();

@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenshot(byte[] screenShot) {
    return screenShot;

Or you can also add Allure helper methods for this

import io.qameta.allure.Allure;


Allure.addAttachment("My attachment", "My attachment content");

Path content = Paths.get("path-to-my-attachment-contnet");
try (InputStream is = Files.newInputStream(content)) {
    Allure.addAttachment("My attachment", is);

Allure Framework official documentation

Sample code to Configure Cucumber to Generate Allure reports. This process involves specifying the Allure plugin and the location for generating JSON reports.

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

    plugin = {
        "json:target/cucumber-report/cucumber.json" // JSON report location
    features = "src/test/resources/features",
    glue = "your.step.definitions.package"
public class CucumberTestRunner {

Generating and Viewing Allure Report with Cucumber Java:

To Generate the Allure Report you can use the following commands

Generate the Allure Report in JSON format

allure generate target/cucumber-report

To open the generated report in the default web browser

allure open
Allure report with cucumber

Method Overloading in Java


Combining Allure reports with Cucumber Java tests elevates your testing and reporting experience to new heights. By following the steps outlined in this guide, you can create beautiful and insightful test reports that improve performance, minimize errors, and provide valuable insights into your test suite’s performance Embrace and leverage the power of Allure your Cucumber test report moves to the next level.

Spread the love

Santosh Adhikari

Hello, it's me Santosh Adhikari, from Kathmandu, Nepal. I'm a student of Science and Technology. I love new challenges and want to explore more on Software Quality Assurance. I want to be a professional SQA. I'm also interested in Blogging, SEO activities.
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments