Có ai có thể nhận được kiểm tra đơn vị phủ sóng của cả hai thử nghiệm đơn vị JMockit và Powermock làm việc trong JaCoCo từ Maven xây dựng?Phạm vi kiểm tra cho cả hai thử nghiệm đơn vị Powermock và JMockit
Tôi có một bộ kiểm tra đơn vị kiểm tra Powermock hiện có, tôi muốn chuyển dần sang JMockit. Nhưng tôi cần để có thể xem thử nghiệm của tất cả các bài kiểm tra đơn vị trong một báo cáo, tốt nhất là ở Sonar.
Tôi đã nhận được các kiểm tra JMockit và Powermock chạy cùng với Surefire/JaCoCo bằng cách đặt JaCoCo vào chế độ "ngoại tuyến" (nếu không tôi gặp sự cố khi một trong các đại lý không bị chấm dứt vào cuối thử nghiệm và sau đó mvn sạch không thể xóa mục tiêu \ surefire \ surefirebooter2967126910681005991.jar trong lần chạy tiếp theo). Nhưng không có bảo hiểm được tạo ra cho các bài kiểm tra JMockit.
Vui lòng đăng một số trích đoạn từ pom của bạn nếu bạn làm việc này.
Đây là những gì pom của tôi trông giống như (lưu ý cắm chắc chắn hơn là congigured với reuseForks = false để workaround rò rỉ bộ nhớ PermGen trong Powermock, đây là một trong những lý do chính để di chuyển đến JMockit)
<profile>
<!-- use this profile to perform Sonar analysis -->
<id>sonar</id>
<properties>
<sonar.language>java</sonar.language>
<!-- Tells Sonar to use the generated test coverage report -->
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<!-- Tells Sonar to use JaCoCo as the code coverage tool -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin>
</properties>
<build>
<plugins>
<!-- surefire (junit) plugin config with JaCoCo listener -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<!-- note: use single JVM to append to JaCoCo coverage file -->
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>-XX:MaxPermSize=256m </argLine>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
<!-- JaCoCo (Sonar) plugin config-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.3.201306030806</version>
<executions>
<execution>
<id>instrument</id>
<phase>process-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>restore</id>
<phase>site</phase>
<goals>
<goal>restore-instrumented-classes</goal>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
<configuration>
<append>true</append>
</configuration>
</plugin>
</plugins>
</build>
</profile>