Automated tests 空手道框架的JSON报告

Automated tests 空手道框架的JSON报告,automated-tests,jenkins-plugins,karate,Automated Tests,Jenkins Plugins,Karate,如何在使用空手道框架时生成JSON报告,以便在JENKINS中使用cucumber reports插件。 我的空手道版本是: 空手道apache-0.8.0 空手道junit4-0.8.0你真的应该阅读以下文档: 网络智囊团 黄瓜报道 3.8.0 测试 公共静态void生成器报告(字符串karateOutputPath){ Collection jsonFiles=FileUtils.listFiles(新文件(karateOutputPath),新字符串[]{“json”},true); L

如何在使用空手道框架时生成JSON报告,以便在JENKINS中使用cucumber reports插件。 我的空手道版本是: 空手道apache-0.8.0
空手道junit4-0.8.0

你真的应该阅读以下文档:


网络智囊团
黄瓜报道
3.8.0
测试
公共静态void生成器报告(字符串karateOutputPath){
Collection jsonFiles=FileUtils.listFiles(新文件(karateOutputPath),新字符串[]{“json”},true);
List jsonpath=newarraylist(jsonFiles.size());
forEach(文件->jsonpath.add(文件.getAbsolutePath());
配置配置=新配置(新文件(“目标”),“演示”);
ReportBuilder ReportBuilder=newreportbuilder(jsonpath,config);
reportBuilder.generateReports();
}
<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();        
}