Measure maven project X coverage by running project Y tests

Hello all,

We need to prove we can measure coverage for a given project by combining coverage db from various test projects.

 

Our structure goes as follows:

  • project-src-x: contains source code which we're interested in measure the coverage.
  • project-it-y: contains integration tests, some of them use the project-x artifact as a maven dependency.
  • project-ut-z: contains unit tests, some of them use the project-x artifact as a maven dependency.

None of this projects share a parent pom, nor can they.

 

This is what I've tried:

 

//instrument project-src-x binaries
$ project-src-x:  mvn clean clover:setup install
 
//run project-it-y tests
$ project-it-y: mvn clean clover:setup -Dmaven.clover.cloverDatabase=/tmp/clover-y.db
 
//run project-ut-z tests
$ project-ut-z: mvn clean clover:setup -Dmaven.clover.cloverDatabase=/tmp/clover-z.db

//merge clover dbs and generate report
$ project-src-x :  mvn clean clover:merge -Dmaven.clover.merge.basedir=/tmp/ clover:clover

The resulting report has no information about project-src-x at all.

I know both test projects are using the instrumented code of project-src-x because I needed to include clover's jar in order to execute them.

 

What can be the problem here?

Thanks in advance,

1 answer

0 vote

$ project-src-x:  mvn clean clover:setup install

Where do you write clover.db file for this project? As you run clover:merge with -Dmaven.clover.merge.basedir=/tmp, then I assume that for project-src-x you should write clover.db to /tmp as well. And the most probably you write it to standard location (<project-src-x dir>/target/clover). 

Please try to run:

mvn clean clover:setup install -Dmaven.clover.cloverDatabase=/tmp/clover.db


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted yesterday in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

51 views 2 2
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you