Skip to content

New Cucumber Plugin to generate json and html report with new status category called "Known Failures" & "Passed With Known Failures"

License

Notifications You must be signed in to change notification settings

seleniumbrain/cucumber-assert-easy-report-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Cucumber Report

Maven Central GitHub

About

EasyCucumberReport is a Java-based Cucumber plugin that generates HTML reports with a modern design. It includes an assertion object to manage known failures.

For unresolved or deferred issues, you can add them to the known failures list. This prevents the report from showing a harsh red failure status, instead displaying results in a more user-friendly amber color.

Tools & Technologies

Tools/Technologies Name Version
JDK JDK 17+
Maven Maven 3.8.9
Lombok Lombok Latest
Cucumber Cucumber 7.17.0
IntelliJ Idea Recommended IDE I - IntelliJ Community Edition
VS Code Recommended IDE II - VS Code Community Edition
Eclipse Recommended IDE III - Eclipse Community Edition

Easy Cucumber Report Usage

Add below maven dependency to your existing pom.xml file

<dependency>
    <groupId>io.github.seleniumbrain</groupId>
    <artifactId>easy-cucumber-report</artifactId>
    <version>1.0.2</version>
</dependency>

Include this plugin to your cucumber runner file org.cucumber.easyreport.core.EasyReportJsonFormatter:<location of an HTML report to be stored>

@CucumberOptions(
        plugin = {
                "pretty",
                "html:test-output/cucumber/cucumber-report.html",
                "json:test-output/cucumber/cucumber-report.json",
                "org.cucumber.easyreport.core.EasyReportJsonFormatter:test-output/easy-cucumber-report/easy-cucumber-report.html"
        },
        features = {
                "src/test/resources/features"
        },
        glue = {
                "org.cucumber.easyreport"
        },
        tags = "@tag"
)
public class CucumberTestCase extends AbstractTestNGCucumberTests {

    @Override
    @DataProvider(parallel = true)
    public Object[][] scenarios() {
        return super.scenarios();
    }
}

Important

Ensure that you have added cucumber.properties file under src/ folder with the below content

# Below are the configurations for Easy Cucumber Report

# this is the location where the regular cucumber JSON report will be stored
easyReport.format.json.conventional=test-output/easy-cucumber-report/easy-cucumber-report.json
# this is the location where the customized cucumber JSON report will be stored
easyReport.format.json.customized=test-output/easy-cucumber-report/easy-cucumber-html-data-report.json
# this is the location where the regular cucumber HTML report will be stored
easyReport.format.html.customized=test-output/easy-cucumber-report/easy-cucumber-report.html

# Maintain below input while carrying out the execution. These will not impact any execution but will be displayed in the report
easyReport.project.info.environment=Development Region
easyReport.project.info.browser=Microsoft Edge
easyReport.project.info.appName=Google
easyReport.project.info.descriptionOrReleaseNotes=Any note that you would like to see on an HTML report, pls type here

easyReport.project.info.project-manager=John, Peter
easyReport.project.info.dq-manager=Dwayne, Johnson
easyReport.project.info.dq-lead=Jonny, Dep

easyReport.project.info.release.name=March 2025 Release
easyReport.project.info.release.date=21-March-2025
easyReport.project.info.release.sprint=Sprint 22

Assertions usage

Create an instance for Assertions class and use its methods to add assertions and known failures to the report.

import io.cucumber.java.en.Given;
import org.cucumber.easyreport.core.Assertions;

public class StepDefinitions {

    @Given("I have a step")
    public void iHaveAStep() {
        Assertions assertions = new Assertions();
        try {

            // your definitions here...

            // to add known failures
            assertions.addKnownFailure(
                    "Device Name Field Validation", // it is the name of the assertion and can be any text. This is just for our reference to identify the assertion
                    "JIRA-1234" // tracking id of the known failure [basically any text]
            );

            // to add assertions
            assertions.assertEqualsTo(
                    "Device Name Field Validation", // it is the name of the assertion and can be any text. This is just for our reference to identify the assertion
                    "Macbook Pro", // actual value to compare
                    "Macbook Air", // expected value to compare
                    "Device Name is not matching. Please check...", // failure message to be displayed in the report
                    "Device Name is matching." // pass message to be displayed in the report
            );
            
            // Note: if you programmatically add known failures, then you should add it before adding assertions with the respective label name
            // In the above example, the known-failure for the label "Device Name Field Validation" is added before adding the assertion for the same label
            
        } finally {
            assertions.assertAll();
        }
    }

}

Note

You can also maintain list of known failures in a YAML file and keep it anywhere under src/ location. Name the file as known-failures.yml and add list of known failures in below format

known-failures.yml

knownFailures:
- label: UserNameField Validation
  trackingId: XLCTCD-1234
  description: any description

- label: LoginButton Validation
  trackingId: XLCTCD-5678
  description: any description

- label: SubmissionCount Validation
  trackingId: XLCTCD-9810
  description: any description

License

This project is licensed under the MIT License—see the LICENSE file for details.

Contact

For any questions or suggestions, please contact the project maintainers rajoviyaa.s@gmail.com


About

New Cucumber Plugin to generate json and html report with new status category called "Known Failures" & "Passed With Known Failures"

Resources

License

Stars

Watchers

Forks

Packages

No packages published