В настоящее время я работаю над покрытием кода Jacoco для проекта Maven с интеграционными тестами Cucumber. Мой файл pom.xml содержит плагины jacoco и failsafe, как показано на рисунках, со ссылкой из https://github.com/dimazelinskyi/jacoco-coverage-cucumber-unit-tests.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.basedir}/target/jacoco-reports/jacoco-test.exec</destFile>
<propertyName>failsafeJacocoAgent</propertyName>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.basedir}/target/jacoco-reports/jacoco-test.exec</dataFile>
<outputDirectory>${project.basedir}/target/jacoco-reports/jacoco-test</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<argLine>${failsafeJacocoAgent}</argLine>
</configuration>
</execution>
<execution>
<id>junit-integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<testNGArtifactName>none:none</testNGArtifactName>
<argLine>${failsafeJacocoAgent}</argLine>
</configuration>
</execution>
<execution>
<id>testng-integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<argLine>${failsafeJacocoAgent}</argLine>
</configuration>
</execution>
</executions>
<configuration>
<includes>
<include>**/CukeRunnerTest.java</include>
</includes>
<systemPropertyVariables>
<isMavenTest>true</isMavenTest>
<client.uri>${wipdm.app.base.url}</client.uri>
<cucumber.options>${async.option}</cucumber.options>
</systemPropertyVariables>
<properties>
<async.option>--tags ~@longRunningTest</async.option>
</properties>
</configuration>
</plugin>
И файл CukeRunnerTest.java выглядит следующим образом: CukeRunnerTest.java
Когда я собираю с помощью maven, т.е. mvn clean install, все тесты успешно проходят, однако я получаю сообщение о том, что
[INFO] Loading execution data file C:\Users\...\IdeaProjects\...\target\jacoco-reports\jacoco-test.exec
[INFO] Analyzed bundle 'wipdata-war' with 0 classes
Сборка прошла успешно и файл jacoco-it.execгенерируется, но отчеты не генерируются.
Это ожидаемое поведение? Поскольку я думал, что jacoco проверит файлы объектов Cucumber внутри «src / test / features / v3» (что указано в CukeRunnerTest.java), чтобы увидеть, какой код в файлах java они рассмотрели в своих интеграционных тестах.
Любой совет или помощь высоко ценится.