I am Trying to achieve code coverage for Azure devops project, I have added Maven Task but, its getting failed and message is build failed.I have added following tasks:
First, you’ll need to convert your Selenium test results to something SonarQube can read, presumably the Generic Test Coverage format.
Then you’ll need to feed that report into analysis, with either a pom property, or a commandline argument, like -D sonar.coverageReportPaths=[path to report].
Backing up a bit, since you have a Maven project, you only need Maven analysis. You don’t need to use the Prepare and end tasks. More details in the docs.
I want to get code coverage using maven task, since selenium is being utilized in this project. So, I have added the pom.xml in maven task, and selected the code coverage option. Also, I have added jacoco property,jacoco maven plugin, and following from this article( Code Coverage with SonarQube and JaCoCo | Baeldung). Please let me know how to generate code coverage for this project.
Before analysis, you need to generate a coverage report SonarQube can read. Then you need to feed that report into analysis. If it’s a JaCoCo report, it should be picked up automatically.