bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

Test in different subproject does not add to test coverage #43

Closed jjathman closed 10 years ago

jjathman commented 10 years ago

I'm not sure if I have something configured incorrectly, or if this is really a bug, any help would be appreciated.

I have a multi-project build. Let's say I have a class in projectA. There is also a test class in projectB. After the cloverAggregateReports task, the coverage report will show that the class will have 0% coverage, but the test will still show that it is run. It seems like coverage information isn't getting recorded when the test is run.

Is this something that is supposed to be supported? Thanks.

bmuschko commented 10 years ago

Can you provide a simplistic example project on GitHub that reproduces the issue?

jjathman commented 10 years ago

Sure, let me put something together for you. Thanks.

jjathman commented 10 years ago

Check out this project I put together, you should be able to pull it down and run cloverAggregateReports, open up the HTML reports, and see the issue. You can see that the "Dog" class isn't covered at all even though the DogService class is covered and that class calls Dog.Speak.

https://github.com/jjathman/clover-multi-project-bug

I'm more than happy to help with a fix if you can get me started in the right direction.

jjathman commented 10 years ago

I spent yesterday working on a way to solve this problem, but I've come to decide that this is more an issue with how clover works than anything with the plugin. It doesn't seem like clover really supports having one subproject contribute code coverage to another subproject. I'm just going to close this issue since it really isn't a problem with this plugin.

bmuschko commented 10 years ago

@jjathman Great, thanks for looking into this. Maybe you can raise an issue on their end.

jjathman commented 10 years ago

@bmuschko Good idea, I asked a question in the Atlassian forums to see if what I'm trying to do is really even possible/supported or not. https://answers.atlassian.com/questions/311974/clover-reporting-for-multi-project-builds

jjathman commented 10 years ago

@bmuschko someone from Atlassian responded and it looks like the root of this issue is the same as issue #33 here. Basically if we could generate Jar's that are instrumented then the reporting would work correctly. Looks like that issue hasn't been updated in a while, I may take a look at it myself. Maybe just add a configuration option to create jars from instrumented sources?

jeeftor commented 9 years ago

Did you ever get this working?

imdira commented 9 years ago

@jjathman @bmuschko have you found any workaround this thing or do you have to create your own clover.gradle version or hack the plugin?

jjathman commented 9 years ago

No sorry I haven't spent any more time on it to get it working. Really the key is my last comment which is how we need to generate instrumented jars instead of what currently happens where only the project being tested is instrumented at runtime.

imdira commented 9 years ago

Thanks, I am trying to work out how to do that.

Alex-Vol commented 7 years ago

The pending milestone release of 2.1.1 will address this issue.