Java API to merge Cucumber JSON reports and build HTML Test Report
Maven dependency for Report Builder:
<dependency>
<groupId>com.rajatthareja</groupId>
<artifactId>reportbuilder</artifactId>
<version>1.0.3</version>
</dependency>
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);
// Enable voice control for report
reportBuilder.enableVoiceControl();
// 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.
Use voice commands for easy navigation and search
- show ( overview, features, summary, errors )
- search { Keywords }
We're open to any contribution. It has to be tested properly though.
Copyright (c) 2018 MIT LICENSE