You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far I've been able to generate the individual reports for:
coverage for @QuarkusTest by adding the quarkus-jacoco dependency
coverage for unit tests by adding the jacoco-maven-plugin
However, things get tricky when trying to get a consolidated report.
Using both the quarkus-jacoco dependency and the jacoco-maven-plugin will either generate a report with 0% test coverage (perhaps an issue with the append configuration on the maven plugin?) or a report that only reflects the coverage provided by the quarkus tests, ignoring the unit tests.
In order to reproduce this issue, clone the test coverage quickstart project linked above, disable the quarkus test testGreetingEndpoint() and run mvn clean verify.
By opening the generated report at target/jacoco-report/index.html we can verify that the greeting() method in the GreetingService has 0% coverage, even thought the unit test for this method is enabled (we disabled the quarkus test since it would cover this method and hide the fact that the unit test doesn't), and so it should be at 100%.
If both quarkus tests are enabled, we get 100% coverage, which is correct
if the 'testGreetingEndpoint()' quarkus test is disabled, we get 57% coverage, which is wrong, this is not considering the coverage provided by the unit test, since we can see that 'greeting(String name)' method has 0% coverage when it should have 100%
if we disable both quarkus tests, we get 0% coverage (unclear if this is expected, since the docs say you must have at least 1 quarkus test in order to use the quarkus-jacoco dependency)
if we comment both quarkus tests (instead of disabling), we get 31% coverage, so in this scenario it is actually considering the coverage from the unit test
In conclusion, it seems that unit tests coverage is being ignored in the consolidated report using the provided instructions both in the guide and quickstart (which has an outdated readme regarding the generated reports).
In these screenshots we can see the expected coverage result provided in Intellij and the incorrect report provided by jacoco.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there 👋 ,
I'm trying to get a consolidated test coverage report for unit and quarkus tests using jacoco (to be used by sonarqube).
I've been following this guide setting-up-jacoco and testing with the provided quickstart tests-with-coverage-quickstart
So far I've been able to generate the individual reports for:
However, things get tricky when trying to get a consolidated report.
Using both the quarkus-jacoco dependency and the jacoco-maven-plugin will either generate a report with 0% test coverage (perhaps an issue with the append configuration on the maven plugin?) or a report that only reflects the coverage provided by the quarkus tests, ignoring the unit tests.
In order to reproduce this issue, clone the test coverage quickstart project linked above, disable the quarkus test testGreetingEndpoint() and run
mvn clean verify
.By opening the generated report at target/jacoco-report/index.html we can verify that the greeting() method in the GreetingService has 0% coverage, even thought the unit test for this method is enabled (we disabled the quarkus test since it would cover this method and hide the fact that the unit test doesn't), and so it should be at 100%.
In conclusion, it seems that unit tests coverage is being ignored in the consolidated report using the provided instructions both in the guide and quickstart (which has an outdated readme regarding the generated reports).
In these screenshots we can see the expected coverage result provided in Intellij and the incorrect report provided by jacoco.
Hopefully you can tell me what I'm missing.
Thanks,
Tiago
Beta Was this translation helpful? Give feedback.
All reactions