BDD-JAVA-是否可以仅以脚本标题生成没有步骤的黄瓜html报告

问题描述 投票:-1回答:1

我目前正在使用HTML格式化程序来生成Cucumber HTML报告。该报告很漂亮,但是我希望仅在所有方案中都以标题为标题来生成报告,这样我的报告就不会很大,并且不容易知道哪些方案失败了。

为了澄清更多,当生成黄瓜HTML报告时。我看到标题分为步骤(通过,失败,跳过,待定,未定义),方案(通过,失败,跳过,待审,未定义),功能。我只想自定义和打印方案并删除步骤部分

enter image description here

公共类HtmlFormatter扩展了CucumberJSONFormatter {私有静态最终字符串TIMESTAMP_FORMAT =“ d MMM yyyy HH:mm:ss:SSS z”;

public HtmlFormatter(Appendable out) {
    super(out);
}

@Override
public void done() {
    super.done();

    final List<String> jsonFiles = new ArrayList<>();
    final ConfigReader configReader = new ConfigReader();
    final File reportOutputDirectory = new File("reports/html");
    final int numThreads = Integer.valueOf(configReader.getProperty("maxThreads", "4"));

    //in case running from single feature file
    if (Main.isFeatureFileExecution()) {
        final String singleFeatureFileExecutionReportPath = "reports/"+configReader.getProperty( "repo","RepoNameNotFound" ) +"/json/report.json";
        if (new File(singleFeatureFileExecutionReportPath).exists()) {
            jsonFiles.add(singleFeatureFileExecutionReportPath);
        }
    } 

    String projectName = “X”;
    boolean runWithJenkins = true;
    boolean parallelTesting = true;

    Configuration configuration = new Configuration(reportOutputDirectory, projectName);
    configuration.setParallelTesting(parallelTesting);
    configuration.setRunWithJenkins(runWithJenkins);

    if (!jsonFiles.isEmpty()) {
        ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
        Reportable result = reportBuilder.generateReports();
    }
}
cucumber gherkin cucumber-java
1个回答
0
投票

基于HTML报告程序编写您自己的自定义报告程序。当您只是想从报告程序中删除一小部分功能时,这并不难。然后在跑黄瓜时使用记者。

© www.soinside.com 2019 - 2024. All rights reserved.