I have this plugin code in my pom.xml. If I remove this plugin then Maven won't run unit tests twice. I just wanted to know which part of this plugin makes the unit tests run twice.
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.0.4</version>
<configuration>
<licenseLocation>/location/to/clover.license</licenseLocation>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>main</id>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>aggregate</goal>
<goal>clover</goal>
</goals>
</execution>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
The clover plugin forks a life cycle up to the test
phase using the instrumented classpath.
Your standard life cycle will run the tests (typically using surefire in the test
phase, but there could be multiple executions or other test plugins invoking tests in that phase)
Then clover comes along and asks for them to be run again.
Now for my standard warning:
If you only ever run your test cases with coverage turned on, you cannot trust a 100% pass rate as coverage can mask bugs
Conversely, if you never run with coverage turned on, any change in JVM architecture can highlight new bugs that you didn't know.
Test passes with and without coverage turned on => probably ok
Test passes with coverage turned on, fails when off => beware, bug here
Test passes with coverage turned off, fails when on => if test is not timing critical then bug here, but if tests run on production environment bug may only show when -server
fully optimises the hot paths
Test fails with and without coverage turned on => bug
"Stephen's golden rule: Just run the damn tests twice"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With