Jacoco doesn't show coverage for tests that use PowerMock 23/86823/3
authorkooper <sergey.sachkov@est.tech>
Tue, 7 May 2019 08:44:41 +0000 (08:44 +0000)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Wed, 8 May 2019 07:30:27 +0000 (07:30 +0000)
Change-Id: I28ff85e10dc449bf41b7ce6657ecdf455e9360d4
Issue-ID: SDC-2260
Signed-off-by: kooper <sergey.sachkov@est.tech>
openecomp-be/pom.xml
pom.xml

index 8d7de5c..7474467 100644 (file)
                 <artifactId>maven-jar-plugin</artifactId>
                 <version>${mvn.jar.version}</version>
             </plugin>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>default-prepare-agent</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>report</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>report</goal>
-                        </goals>
-                    </execution>
-                    <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>target/jacoco.exec</dataFile>
-                            <!-- Sets the output directory for the code coverage report. -->
-                            <outputDirectory>target/jacoco-ut</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
         </plugins>
     </build>
 
diff --git a/pom.xml b/pom.xml
index 7f11a54..04d4a24 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -139,6 +139,8 @@ Modifications copyright (c) 2018 Nokia
 
         <joda.time.version>2.9.9</joda.time.version>
 
+        <!--jacoco-->
+        <jacoco.version>0.8.1</jacoco.version>
 
     </properties>
 
@@ -232,6 +234,17 @@ Modifications copyright (c) 2018 Nokia
         </dependencies>
     </dependencyManagement>
 
+    <dependencies>
+        <dependency>
+            <!-- must be on the classpath -->
+            <groupId>org.jacoco</groupId>
+            <artifactId>org.jacoco.agent</artifactId>
+            <classifier>runtime</classifier>
+            <version>${jacoco.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
     <reporting>
         <plugins>
             <plugin>
@@ -389,9 +402,15 @@ Modifications copyright (c) 2018 Nokia
                 <artifactId>jacoco-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>default-prepare-agent</id>
+                        <id>default-instrument</id>
                         <goals>
-                            <goal>prepare-agent</goal>
+                            <goal>instrument</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>default-restore-instrumented-classes</id>
+                        <goals>
+                            <goal>restore-instrumented-classes</goal>
                         </goals>
                     </execution>
                     <execution>
@@ -399,6 +418,9 @@ Modifications copyright (c) 2018 Nokia
                         <goals>
                             <goal>report</goal>
                         </goals>
+                        <configuration>
+                            <dataFile>${project.build.directory}/jacoco.exec</dataFile>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>
@@ -454,6 +476,9 @@ Modifications copyright (c) 2018 Nokia
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <printSummary>false</printSummary>
+                    <systemPropertyVariables>
+                        <jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
+                    </systemPropertyVariables>
                 </configuration>
             </plugin>
             <plugin>