ReportBuilderJava

Build status Maven Central

Java API to merge Cucumber JSON reports and build HTML Test Report

Sample Reports

View Sample Report

Include Report Builder in your project

Maven dependency for Report Builder:


<dependency>
    <groupId>com.rajatthareja</groupId>
    <artifactId>reportbuilder</artifactId>
    <version>1.0.2</version>
</dependency>

Build your test report


import com.rajatthareja.reportbuilder.ReportBuilder;
import com.rajatthareja.reportbuilder.Color;
import org.json.JSONObject;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

class MyClass {
    
    public static void main(String ... args) throws Exception{
        // Create ReportBuilder Object
        ReportBuilder reportBuilder = new ReportBuilder();
        
        // Set output Report Dir 
        reportBuilder.setReportDirectory("output/");
        
        // Set output report file name
        reportBuilder.setReportFileName("test_results");
        
        // Set Report Title
        reportBuilder.setReportTitle("My Test Report");
        
        // Set Report Color for more visit http://materializecss.com/color.html
        reportBuilder.setReportColor(Color.PURPLE);
        
        // Add additional info for Report
        reportBuilder.setAdditionalInfo("Environment", "My Environment");

        // Create list or report Files or Directories or URLs or JSONObject or JSONString
        List<Object> cucumberJsonReports = new ArrayList<>();
        cucumberJsonReports.add(new File("my/report/path/report.json"));
        cucumberJsonReports.add(new File("myReportDir/"));
        cucumberJsonReports.add(new URL("http://myReportUrl/report.json"));
        cucumberJsonReports.add(new JSONObject("report Json String"));
        
        // Build your report
        reportBuilder.build(cucumberJsonReports);
    }
}

Note: Java > 8 is required.

View Java Docs for more details.

Report Builder Ruby Gem

Report Builder

Contributing

We’re open to any contribution. It has to be tested properly though.

License

Copyright (c) 2018 MIT LICENSE