Ours is a multi module maven project and using clover2:instrument to generate instrumented fat jar.
We evaluate functional test code coverage using the instrumented jar from command line, all steps mentioned below :
1) mvn clean install
2) mvn -P instrumentation clover2:instrument
3) Run functional test
4) mvn -P instrumentation clover2:aggregate
5) mvn -P instrumentation clover2:clover site
All unit tests passes with clover 4.0.2 however they fail with NPE when clover version 3.1.8 is used. We want to use older version because we have commercial license for it and not for newer version.
Kindly help.
I cannot share the logs as this might offend my organisation policies. Sharing the excerpt
Tests run: 6, Failures: 6, Errors: 0, Skipped: 0, Time elapsed: 0 sec <<< FAILURE! com.***.*.*.*.*.drools.*.*************UnitTest.testKnowledgeAgentInitialization() Time elapsed: 0 sec <<< FAILURE! java.lang.NullPointerException at com.***.*.*.*.*.drools.*.*************UnitTest.testKnowledgeAgentInitialization(*************UnitTest.java:149)
Parent POM for clover:
<profiles> <profile> <id>instrumentation</id> <activation> <property> <name>instrumentation</name> </property> </activation> <dependencies> <dependency> <groupId>com.atlassian.clover</groupId> <artifactId>clover</artifactId> <version>${version.clover}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-clover2-plugin</artifactId> <version>${version.clover}</version> <configuration> <license>${clover.license}</license> <includesTestSourceRoots>false</includesTestSourceRoots> </configuration> <executions> <execution> <id>site</id> <phase>pre-site</phase> <goals> <goal>aggregate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile>
We are using Surefire to run Unit tests
<artifactId>maven-surefire-plugin</artifactId> <version>2.14.1</version> <configuration> <includes> <include>**/*UnitTest.java</include> </includes> </configuration>
Thanks Marek....but this didn't help....
1) I deleted all the clover jars from .m2 repo (del /S*-clover.jar) .
2)Ensured that dependency has proper groupId
<dependency>
<groupId>com.cenqua.clover</groupId>
<artifactId>clover</artifactId>
<version>${version.clover}</version>
</dependency>
3)Ran clover2:instrument, (mvn -P instrumentation clover2:instrument >>log.txt)
This log file created shows Failed unit tests with Null Pointer Exception
Kindly help
You wrote that you cannot paste more details here due to your company's policies. However, would it be possible to attach this data to a support ticket (you can create one on support.atlassian.com)? Such ticket will be visible by you and by our Atlassian Support team only.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean to open an OnDemand ticket and since it is visible to only internal team , attach the entire log file of instrumentation run ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Open https://support.atlassian.com, select "Dev Tools" and next select "Clover Support". Next log in using your AtlassianID (or create a new account) and please attach the Maven build log + one JUnit log (TEST-*.xml) from one failing test case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One more thing. You have the following dependency declared:
<dependencies> <dependency> <groupId>com.atlassian.clover</groupId> <artifactId>clover</artifactId> <version>${version.clover}</version> </dependency> </dependencies>
Please note that for Clover 3.x the artifact should have:
<groupId>com.cenqua.clover</groupId>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Clover 3.x and Clover 4.x are not binary compatible (a lot of classes have been renamed), therefore you have to ensure that you don't mix the code generated by Clover 3.x with a code generated by Clover 4.x. Please have a look at the "Upgrading from Clover 3.3 to Clover 4.0" chapter in the https://confluence.atlassian.com/display/CLOVER/Clover+4.0+Release+Notes
Especially, when you switch from Clover 3.3 to 4.0 (or the opposite way), clean your entire workspace and ~/.m2 cache from old classes and jars:
It's recommended to delete or to rebuild all artifacts instrumented by Clover and having the 'clover' classifier (e.g. my-module-1.0-clover.jar) from ~/.m2 caches and build workspaces. When you run clover2:setup or clover:instrument, Clover tries to find an instrumented version of dependent artifacts and to use such "clovered" artifact instead of the original one. Due to a fact that some Clover's classes have been renamed in Clover 4, it may lead to java.lang.NoClassDefFoundError or java.lang.VerifyError at runtime when an instrumented JAR with old Clover will be found.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.