集成覆盖结果未显示在声纳中
integration coverage results not shown in sonar
我正在尝试在我的声纳实例中获取集成测试统计信息。经过大量搜索,我仍然没有发现我做错了什么。我使用配置文件来跳过 (IT) 测试,这似乎对我有用。
在 jenkins 中,我的声纳构建目标是
verify -P integration-test -Dsonar.phase=verify
以及我之前的集成测试构建
failsafe:integration-test -P integration-test
我有以下pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>analyze</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<!-- Run integration tests (*IT) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>${skipITTests}</skipTests>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<argLine>${jacoco.agent.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report-integration</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
</executions>
</plugin>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-report-plugin.version}</version>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>false</skipUnitTests>
<skipITTests>true</skipITTests>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
</profile>
<profile>
<id>integration-test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>true</skipUnitTests>
<skipITTests>false</skipITTests>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>true</skipUnitTests>
<skipITTests>false</skipITTests>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<sonar.jdbc.url>jdbc:mysql://sonar-url/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url>
<sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://sonar-url/</sonar.host.url>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>target/jacoco.it.exec</sonar.jacoco.itReportPath>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<!-- Sonar exclusions **/static/libs/*.js: third-party JavaScript libraries -->
<!-- **/jquery*.js: third-party jQuery libraries -->
<!-- src/main/webapp/static/styles/css/bootstrap/bootstrap*.css src/main/webapp/static/styles/css/bootstrap*.css
default Bootstrap CSS files -->
<!-- (regular & minified) src/main/webapp/static/app/services/ogmSvc.js: angular service lib -->
<sonar.exclusions>**/static/libs/*.js, **/jquery*.js,
src/main/webapp/static/styles/css/bootstrap/bootstrap*.css,
src/main/webapp/static/styles/css/bootstrap*.css,
src/main/webapp/static/app/services/ogmSvc.js
</sonar.exclusions>
</properties>
</profile>
谁能告诉我我做错了什么或忘记了什么?
谢谢
可能您已经这样做了,但不要忘记在您的声纳服务器中添加集成测试小部件。 (默认登录名是 admin-admin)
问题是我错误地配置了 jacoco,因此报告的位置与声纳接收它们的位置不同。
我正在尝试在我的声纳实例中获取集成测试统计信息。经过大量搜索,我仍然没有发现我做错了什么。我使用配置文件来跳过 (IT) 测试,这似乎对我有用。
在 jenkins 中,我的声纳构建目标是
verify -P integration-test -Dsonar.phase=verify
以及我之前的集成测试构建
failsafe:integration-test -P integration-test
我有以下pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>analyze</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<!-- Run integration tests (*IT) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>${skipITTests}</skipTests>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<argLine>${jacoco.agent.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report-integration</goal>
</goals>
<configuration>
<destfile>${project.build.directory}/jacoco.it.exec</destfile>
<datafile>${project.build.directory}/jacoco.it.exec</datafile>
</configuration>
</execution>
</executions>
</plugin>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-report-plugin.version}</version>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>false</skipUnitTests>
<skipITTests>true</skipITTests>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
</profile>
<profile>
<id>integration-test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>true</skipUnitTests>
<skipITTests>false</skipITTests>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<maven.test.skip>false</maven.test.skip>
<skipUnitTests>true</skipUnitTests>
<skipITTests>false</skipITTests>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<sonar.jdbc.url>jdbc:mysql://sonar-url/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url>
<sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://sonar-url/</sonar.host.url>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>target/jacoco.it.exec</sonar.jacoco.itReportPath>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<!-- Sonar exclusions **/static/libs/*.js: third-party JavaScript libraries -->
<!-- **/jquery*.js: third-party jQuery libraries -->
<!-- src/main/webapp/static/styles/css/bootstrap/bootstrap*.css src/main/webapp/static/styles/css/bootstrap*.css
default Bootstrap CSS files -->
<!-- (regular & minified) src/main/webapp/static/app/services/ogmSvc.js: angular service lib -->
<sonar.exclusions>**/static/libs/*.js, **/jquery*.js,
src/main/webapp/static/styles/css/bootstrap/bootstrap*.css,
src/main/webapp/static/styles/css/bootstrap*.css,
src/main/webapp/static/app/services/ogmSvc.js
</sonar.exclusions>
</properties>
</profile>
谁能告诉我我做错了什么或忘记了什么?
谢谢
可能您已经这样做了,但不要忘记在您的声纳服务器中添加集成测试小部件。 (默认登录名是 admin-admin)
问题是我错误地配置了 jacoco,因此报告的位置与声纳接收它们的位置不同。