jacoco coverage not update

888 views
Skip to first unread message

a.th...@gmail.com

unread,
Dec 8, 2017, 2:14:26 AM12/8/17
to JaCoCo and EclEmma Users
Im using Powermock to mock some static methods for unit testing and I found that jacoco on-the-fly coverage analysis is not updated for mock unit tests.

Because of that I tried to use jacoco offline analysis.With that I was able to get the coverage results.
There after I found that when I write new test cases the Jacoco will not update the coverage. It is still keeping old coverage.

following is my maven configuration


<!-- Code coverage -->


<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>

<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
<configuration>
<skip>${jacoco.skip.instrument}</skip>

</excludes>
</configuration>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<phase>pre-integration-test</phase>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
<configuration>
<skip>${jacoco.skip.instrument}</skip>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exe</dataFile>
<excludes>
<exclude>

</excludes>
</configuration>
</execution>
</executions>

Evgeny Mandrikov

unread,
Dec 8, 2017, 5:56:15 AM12/8/17
to JaCoCo and EclEmma Users
Hello,


On Friday, December 8, 2017 at 8:14:26 AM UTC+1, a.th...@gmail.com wrote:
Im using Powermock to mock some static methods for unit testing and I found that jacoco on-the-fly coverage analysis is not updated for mock unit tests.

Because of that I tried to use  jacoco offline analysis.With that I was able to get the coverage results.
There after I found that when I write new test cases the Jacoco will not update the coverage. It is still keeping  old coverage.


First of all - what means "will not update the coverage. It is still keeping old coverage"? Which tests did you had, which tests did you add? Which result did you expected? Which result did you get?
Clearly snippet of pom.xml is not enough to answer all these question. Please read and study something about how to properly report problems, e.g. https://stackoverflow.com/help/mcve and https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Then note that as specified in documentation ( http://www.jacoco.org/jacoco/trunk/doc/offline.html ) and as shown in various examples :

In offline mode ... There are two different ways to provide the configuration:
Configuration File: ...
System Properties: ...

Both are absent in your snippet, so one might assume that it is not configured and hence default location of exec file is not the one that you expect for generation of report ( "${project.build.directory}/jacoco.exe" ).

Third - there is configuration option "append" that is "true" by default, which means that subsequent executions will not overwrite exec file but append to it. Hence unless it is explicitly removed, it will be accumulating previous data.

Regards.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages