bmuschko / gradle-clover-plugin

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

Clover configuration modifies the test files included in a test type task even with testIncludes #122

Open freshcodemonger opened 6 years ago

freshcodemonger commented 6 years ago

I have a Test type that I have defined.

task mytest(type: Test) { include "/mypackage/" }

and I've told clover to only include the mypackage tests.

clover { testIncludes = ['/mypackage//*Test.java'] //excludeTasks = ["mytest"] }

when clover runs it properly detects 89 classes for clover reporting but it causes the mytest task to execute ~500 tests instead of the 89 that normally execute when clover is disabled.

How can I prevent clover from modifying the tests that are included in my "mytest" task? For now I've just decided that I'll have clover exclude mytest task from being a part of clover so that I only run the 89 tests as I had intended.

Thank you !

Alex-Vol-SV commented 6 years ago

From your description I assume that the source set you used has more tests and you are narrowing down the active ones using the include pattern. I believe this is a known current limitation of the way we integrate Clover into the Test tasks. We do not carry over the Test task filter in the processing actions and this results in the behavior you experience.

freshcodemonger commented 6 years ago

Your assumption is correct. I also use the eclipse open clover plugin which allows you to run the coverage for only a portion of your junit tests. On a large project is nice to be able to run only a portion of the test.

Thank you for all the work on the plugin !