Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,257,453
Community Members
 
Community Events
164
Community Groups

Maven +Openclover generate aggrigate test report for multi-module project

Dears,

Parent.pom
     module1.pom
         target/clover/module1Clover.db
     module2.pom
         target/clover/module2Clover.db
    module3.pom
        target/clover/module3Clover.db
    plkModule


I want to merge all 3 modules clover dbs in to one db in PlkModule and have a report(test coverage report) ,
How to do this? Could you please advice?

 

Regards

Raveendra

1 answer

0 votes

Hi Raveendra,

We do this in a couple of our projects and it is not too tricky.

The aggregate goal will merge all of the moduleXClover.DB into a single db and then you can use the clover task to generate the report.

For example, if running locally, and you have the open-clover plugin specified in your pom.xml  you can run:

mvn clover:setup test clover:aggregate clover:clover

The final "clover:clover" instruction will generage a report based on the merged database, which I think is the second part of your question.

Once it is working locally you can incorporate it in your bamboo build by exposing the report as an artifact and selecting "I already integrated a code coverage tool in this job." and putting in the path to the report.

Dear Richard

 

Thank you very much for your answer..!!!

 

Now I am getting "

'has 2 candidates, please provide a classifier.'

for one of a module.. Please advice.

"

Could you please advice , when giving maven goals as pom configuration, I am providing goals in my pom as "instrument,aggregate,clover,"

 

Please find below pom file...

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>clover-maven-plugin</artifactId>

<configuration>

</configuration>
<executions>
<execution>
<phase>install</phase>
<!--<phase>pre-site</phase>-->
<goals>
<goal>instrument</goal>
<goal>aggregate</goal>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>

 

Regards

Raveendra

Hi Raveendra,

Unfortunately that's not an error I have seen before, and other than suggesting you use the newer open clover clover-maven-plugin,  I'm not sure what could be wrong with that configuration.

Thanks Richard for your reply!!.I  was able to generate coverage which is not much accurate form the below pom.


<plugin>
                <groupId>org.openclover</groupId>
                <artifactId>clover-maven-plugin</artifactId>
                <version>4.4.1</version>
                <configuration>
           
                    <flushPolicy>threaded</flushPolicy>
                    <flushInterval>30000</flushInterval>
                    <!--<includesTestSourceRoots>false</includesTestSourceRoots>-->
                </configuration>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <!--<phase>pre-site</phase>-->
                        <goals>
                            <!--<goal>clean</goal>-->
                            <goal>instrument-test</goal>
                            <goal>aggregate</goal>
                            <goal>clover</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

But After I added exclusions Coverage become zero.Please find below pom after adding  excludes. Could you please advice?


<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.4.1</version>
<configuration>

<excludes>
<exclude>**/*_InternalTmp.java</exclude>
</excludes>
<flushPolicy>threaded</flushPolicy>
<flushInterval>30000</flushInterval>
<!--<includesTestSourceRoots>false</includesTestSourceRoots>-->
</configuration>
<executions>
<execution>
<phase>install</phase>
<!--<phase>pre-site</phase>-->
<goals>
<!--<goal>clean</goal>-->
<goal>instrument-test</goal>
<goal>aggregate</goal>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>

Regards

Raveendra

Hi again Raveendra,

I personally I would try the goals

- clean

- instrument (not instrument-test)

- aggregate

- clover

For testing I would remove the flush policy and flushInterval and just use the default settings. I am assuming you are just doing coverage for unit tests via surefire at the moment, not trying to get coverage for integration or functional tests?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

675 views 3 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you