Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report is empty #167

Open
spartanhooah opened this issue Feb 10, 2020 · 3 comments
Open

Report is empty #167

spartanhooah opened this issue Feb 10, 2020 · 3 comments

Comments

@spartanhooah
Copy link

spartanhooah commented Feb 10, 2020

I added cobertura 3.0.0 to an existing Java project and the cobertura task ran fine and generated the report files, but there are no packages listed, 0 classes, and all coverage columns are N/A. Any idea what's going on? Here's my repo at the point when I added the plugin: https://github.com/spartanhooah/recipe/tree/1056981a23c130b593b7bc60d3196e20b6b1b888

Java version 11.0.5
Gradle wrapper 5.4.1

@stevesaliman
Copy link
Owner

When I look at the output from gradle cobertura, I see that Cobertura itself can't instrument any of the classes. I have no idea why. Cobertura has some known issues with Java 8+, but I have a Spring Boot project of my own that instruments fine. There are known issues with Cobertura instrumenting classes with static methods, but I don't think that is the issue here because you have classes that don't have any. Your sample project is pretty simple, so I don't think it is some strange dependency problem.

At the moment, I have no idea what might be going on. All I can say at this point is that uninstrumented classes will not show any coverage when the tests themselves run, so the solution will be to figure out why Cobertura is having an issue with the classes in your project.

@jjba23
Copy link

jjba23 commented Jan 15, 2021

Bump. I am having the same issue, with a Groovy only project. All seems to go fine, except there occur actually no coverage checking. Tests run, files get generated, but no coverage.

@chgans
Copy link

chgans commented Sep 18, 2021

Same issue with net.saliman.cobertura 4.0.0, groovy 2.4 and gradle 6.2.2.
Reports is empty:

> Task :instrument
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file

> Task :test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/chgans/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.12/760afc568cbd94c09d78f801ce51aed1326710af/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

> Task :generateCoberturaReport
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 15ms
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 13ms

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
7 actionable tasks: 7 executed

Fixed by using this:

cobertura {
    coverageFormats = ['html', 'xml']
    coverageDirs = [file("${buildDir}/classes/groovy/main")]
}

Don't ask me why? just copy/paste from some projects found on gitlab...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants