Reputation: 313
Hello how can I exclude all my inherited classes from Jacoco report Coverage. for example- I have a BaseActivity and multiple sub Activity for Example A,B,C. And I want to exclude the report of all the subActivities.
I have multiple sub Activity so that I can not write the name of All these subActivities to exclude in gradle file, so is there any way that if I will just give the name of Parent Activity in gradle and all the subActivities name will exclude from the jacoco report.
Please help.
Upvotes: 2
Views: 920
Reputation: 28126
I don't think it's possible, since there are no such a filtering option yet. You can see them here.
As per my point of view, the only way you can do it by filtering your sub-classes by name of the class or some package, which contains you sub-classes. Sure, for that you must name all your sub-classes with some specific name.
How to filer coverage by names you can read in this SO question. You just need to modify jacocoTestReport
task configuration to exclude some classes or packages as follows:
jacocoTestReport {
...
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['codeeval/**',
'crackingthecode/part3knowledgebased/**',
'**/Chapter7ObjectOrientedDesign**',
'**/Chapter11Testing**'])
})
}
}
Upvotes: 2