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

Clover code coverage behavior differs between Maven and Gradle

I am migrating a Maven Project to Gradle and I have an issue with my code coverage plugin : Clover. I have an unexplained behavior about coverage computation. Let's take a simple example :

// ProjectA
class A
{
    void method1()
    {
        // Some stuff
        // This method is covered by a unit test in ProjectA
    }
    
    void method2()
    {
        // Some stuff
        // This method is not covered by any unit test in ProjectA
    }
}
// ProjectB
class B
{
    void method3()
    {
        new A().method2();
        // Some stuff
        // This method is covered by a unit test in ProjectB
    }
}

I have 2 different project : ProjectA and ProjectB. ProjectB depends on ProjectA.

ProjectA contains a class named A. method1 from A is covered by a unit test contained in ProjectA. method2 is not covered by any test contained in ProjectA.

ProjectB contains a class named B. method3 from B is covered by a unit test contained in ProjectB. method3 calls method2 from class A in ProjectA.

The fact :

With Maven and Clover (official plugin), method2 is considered covered as it's call from a method (method3) covered by a unit test, even if the test is in a different project. With Gradle and Clover (unofficial plugin), method2 is considered uncovered as there is no dedicated test in ProjectA.

The configuration is kind of basic, no major difference between Maven and Gradle Clover plugin.

My questions :

What is the normal / default behavior of Clover ? Can this behavior be set through configuration ? Or is this some kind of bug in the Gradle Clover plugin ?

 

 

1 answer

0 votes

I guess that in your Gradle build two clover.db databases have been created: one for ProjectA and one for ProjectB. Am I correct?

If yes then did you merge these two databases into one for reporting?

If yes then did you use the "aggregateDatabases" or the "aggregateReports" task? 

 

https://github.com/bmuschko/gradle-clover-plugin/blob/master/src/main/groovy/com/bmuschko/gradle/clover/AggregateDatabasesTask.groovy

https://github.com/bmuschko/gradle-clover-plugin/blob/master/src/main/groovy/com/bmuschko/gradle/clover/AggregateReportsTask.groovy

I used the task cloverAggregateReports which pretty covers it all as I am in multi project architecture.

My build.gradle file is on top of projectA and ProjectB

Suggest an answer

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

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

171 views 2 9
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