Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

556 views 6 7
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