问题
How can I produce a JSON report while using karate framework so that I can use it in JENKINS using the cucumber reports plugin. My Karate version are: karate-apache - 0.8.0 karate-junit4 - 0.8.0
回答1:
You really should read the docs: https://github.com/intuit/karate/tree/master/karate-demo#example-report
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
public static void generateReport(String karateOutputPath) {
Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File("target"), "demo");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
来源:https://stackoverflow.com/questions/52810138/json-report-for-karate-framework