Каратэ 0.9.1 не генерирует cucumber.json, который используется для отчетов о огурцах - PullRequest
0 голосов
/ 29 января 2019

При использовании Каратэ 0.6.1 с огурцом.Он генерирует результаты теста в файл cucumber.json по пути, указанному в коде.

Затем он используется для генерации отчетов об огурцах с помощью Masterthought.

@RunWith(Karate.class)

@CucumberOptions(monochrome = true, features = "SampleFeature.feature", 
plugin = {"pretty", "html:target/site/cucumber-pretty", 
"json:target/cucumber-html-reports/cucumber.json" })

Но когда мы перешли на Каратэ 0.9.1 для чтения входных данных из CSV-файла.Теперь он не может создать cucumber.json, поэтому отчеты не работают с FileNotFoundException.

Прикреплен плагин для masterthought в pom.xml

    <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>3.15.0</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                    <!--    optional, per documentation set this to "true" to bypass
                        generation of Cucumber
                        Reports entirely, defaults to false if not specified -->
                        <skip>false</skip>
                        <!-- output
                        directory for the generated report -->
                        <outputDirectory>${project.build.directory}</outputDirectory>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <inputDirectory>${project.build.directory}/surefire-reports</inputDirectory>
                        <jsonFiles>
                            <!-- supports wildcard or name pattern -->
                            <param>target/cucumber-html-reports/cucumber-json-report.json</param>
                        </jsonFiles>
                        <cucumberOutput>${project.build.directory}/cucumber-html-reports/cucumber.json</cucumberOutput>
                    <!--    optional, defaults to outputDirectory if not specified -->
                        <classificationDirectory>${project.build.directory}/classifications</classificationDirectory>
                        <classificationFiles>
                            supports wildcard or name pattern
                            <param>sample.properties</param>
                            <param>other.properties</param>
                        </classificationFiles>
                        <parallelTesting>false</parallelTesting>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Может кто-нибудь подсказать, что изменилось с 0.6.1 до 0.9.1?

А что мне делать, чтобы создать файл cucumber.json?

1 Ответ

0 голосов
/ 29 января 2019

В карате 0.9.0 и выше единственными поддерживаемыми параметрами в аннотации являются features и tags, больше ничего.Каратэ больше не основано на огурце .

Параллельный бегун сгенерирует JSON, который вы ожидаете в target/surefire-reports по умолчанию.Пожалуйста, внимательно прочитайте этот раздел документации: https://github.com/intuit/karate#parallel-execution

Так что вы должны сделать следующее:

  • не использовать @RunWith(Karate.class)
  • использовать @KarateOptions(features = "SampleFeature.feature")
  • используйте Runner.parallel()
  • , не используйте maven-cucumber-reporting как plugin, используйте вместо него dependency, см. Это: https://github.com/intuit/karate/tree/master/karate-demo#example-report
  • написать (несколько строк) код для использования JSON, сгенерированного, как описано в приведенной выше ссылке
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...