Does generation of Java Code Coverage report require attaching Jacoco agent to application?

I’m using 7.9.1 SonarQube = 4.2 SonarScanner CLI

I’m interested in generating coverage report for my java files and I see that SonarScanner requires XML report generated by JaCoCo for which a jacocoagent should be attached to my source application.

Is there a work around for this wherein the above process is abstracted somehow or is there a configuration withing SonarScanner that would do the job?

Also, what would be the solution for coverage information of .NET application? do we have to rely on OpenCover/dotCover?

there is no workaround for JaCoCo, but the process can be quite seamless if you use maven or gradle plugins - we have a small guide on how to do it here [Coverage & Test Data] Importing JaCoCo coverage report in XML format

I am not so familiar with .NET, I let somebody else answer.

Hi Danush,

Yes, exactly, we rely on OpenCover or dotCover. You can find the test coverage docs here: Test Coverage & Execution | SonarQube Docs

1 Like

Thanks Blenessy for the link. I worked with maven plugin to generate the coverage report before moving to CLI for a more general purpose solution supporting other languages as well.

Hi Zaharia,

Thanks for the confirmation. Could you help me with other robust coverage tool for .NET applications that would also support visualization?

Hi Danush,

Currently we support, also with visualization, Visual Studio Code Coverage, dotCover and OpenCover. All of them are robust and widely used from what I can tell.