Функция отображения отчетов о огурцах в net.masterthought работала вдвое - PullRequest
0 голосов
/ 01 марта 2020

На самом деле, у меня есть только одна функция, но в отчетах по огурцам эта функция запускалась дважды. Ниже приведена версия, которую я использую

        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>5.1.1</version>
        </dependency>

Пожалуйста, найдите ниже огурец. json

[
  {
    "line": 3,
    "elements": [
      {
        "line": 5,
        "name": "",
        "description": "",
        "type": "background",
        "keyword": "Background",
        "steps": []
      },
      {
        "start_timestamp": "2020-03-01T15:30:51.681Z",
        "line": 7,
        "name": "Title of your scenario",
        "description": "",
        "id": "my-first-test-feature-to-check-the-setup;title-of-your-scenario",
        "type": "scenario",
        "keyword": "Scenario",
        "steps": [
          {
            "result": {
              "duration": 5000000,
              "status": "passed"
            },
            "line": 8,
            "name": "I want to write a step with precondition",
            "match": {
              "location": "stepDefinition.preDefinedSteps.i_want_to_write_a_step_with_precondition()"
            },
            "keyword": "Given "
          }
        ],
        "tags": [
          {
            "name": "@test"
          }
        ]
      }
    ],
    "name": "My first test feature to check the setup",
    "description": "",
    "id": "my-first-test-feature-to-check-the-setup",
    "keyword": "Feature",
    "uri": "file:src/test/resources/features/myfirst.feature",
    "tags": [
      {
        "name": "@test",
        "type": "Tag",
        "location": {
          "line": 2,
          "column": 1
        }
      }
    ]
  }
]

Ниже приведен код для генерации отчета

public static void generateReport() {
        String OutputPath = "target/cucumber-reports";
        Collection<File> jsonFiles = FileUtils.listFiles(new File(OutputPath), new String[] {"json"}, true);
        List jsonPaths = new ArrayList(jsonFiles.size());
        for (File file : jsonFiles){
            jsonPaths.add(file.getAbsolutePath());
        }
        jsonFiles.removeIf(file->file.length()==0);
        jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
        Configuration config = new Configuration(new File("target"), "test project");
        ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
        reportBuilder.generateReports();        
    }

И отчет выглядит следующим образом: он показывает 2 функции, но у меня есть только одна функция enter image description here

Может кто-нибудь помочь мне исправить это.

...