Как я уже ответил here: Вы можете поместить все отчеты вместе в одной папке (не забудьте назвать по-другому!) И используют слияния харизмы для того, или использовать центральный уникальный файл для всех отчетов, добавив флаг «добавить»:
-javaagent:append=true,destFile=/home/YourProject/report.exec
[Здесь] [2] вы найдете более подробную информацию о том, как настроить агент.
Надеюсь, это поможет!
(это копия моего other ответа на одной и той же проблемы)
EDIT:
Пока вы просили различного рода исполнения (единицы и интеграции) Я предполагаю, что вы используете разные плагины для выполнения ваших тестов.
То, что вы должны сделать, это подготовить два агентов JaCoCo и дать argLine из них плагина, который будет выполнять тест:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed.
-->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/jacoco.exec</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!--
Ensures that the code coverage report for unit tests is created after
unit tests have been run.
-->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
</configuration>
</execution>
<!-- The Executions required by unit tests are omitted. -->
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Failsafe plugin is executed.
-->
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<!--
Ensures that the code coverage report for integration tests after
integration tests have been run.
-->
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Затем вы должны настроить плагин (обычно используются отказоустойчивым и безошибочными) для принятия argLine, созданного для агентов JaCoCo:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefireArgLine}</argLine>
</configuration>
</plugin>
То же самое для отказоустойчивого плагина.
Вы пробовали плагин cobertura? с агрегированным флагом в true, он должен выполнить то, что вы просите – Sammyrulez
НЕТ ... Я пробовал с Jacoco с подключаемым модулем Jetty, потому что мои тесты интеграции выполняются после развертывания jar на причальном сервере. Можете ли вы привести мне пример? –
@Sammyrulez, пожалуйста, предоставьте мне пример, как я могу это достичь. благодаря! –