Mavenを使用して、ローカルのJenkinsサーバーでコードカバレッジを設定しようとしています。私のテストがカバレッジ レポートに含まれていないようです。
pom.xml に次のものがあります。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<check>
<haltOnFailure>false</haltOnFailure>
<totalLineRate>85</totalLineRate>
</check>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>site</phase>
<goals>
<goal>instrument</goal>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
ここで、実行するテストを定義します
<plugin>
<!-- Separates the unit tests from the integration tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<trimStackTrace>false</trimStackTrace>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*Test*.java</include>
</includes>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
そして、私のJenkinsサーバーには次のものがあります: Jenkins Configuration: Sonar Sonar name:sonar local 3.5.1 server url:http://local host:9000
プロジェクト レベル: Cobertura Coverate レポートの発行: xml レポート パターン: **/target/site.covertura/coverage.xml
しかし、Maven タスク「mvn cobertura:cobertura」を実行するか、Jenkins でソナー レポートを表示すると、すべてのカバレッジが 0% になり、ユニット テストと統合テストが表示されていないと思います。
これは、pom が単体テストと統合テストを分離する方法に問題がありますか?