0

I'm trying to see my code coverage in my pipeline summary 68 passing tests

project details: Java spring

Error: ##[warning]No code coverage results were found to publish.

Pipeline:

- task: Maven@3
    displayName: Maven SoftwareEngineeringBackend/pom.xml
    inputs:
      mavenPOMFile: $(BuildParameters.mavenPOMFile)
      goals: "test"
  - task: PublishTestResults@2
    displayName: "Publish test results"
    inputs:
      testResultsFormat: "JUnit"
      mergeTestResults: true
  - task: PublishCodeCoverageResults@1
    inputs:
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/target/site/jacoco/jacoco.xml'
      pathToSources: '$(System.DefaultWorkingDirectory)/src/main/java/'

1 Answers1

-1

Firstly check if you have added the Jacoco plugin in your Pom.xml or not. If added then add configuration for it to enable XML report i.e xml.enabled true.

After mvn build process is finished go to the build or target directory and find the path of XML report most probably it will be $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml for Gradle and {System.DefaultWorkingDirectory}/**/reports/jacoco/test/jacocoTestReport.xml for Maven

Reference -

  1. https://iamvickyav.medium.com/code-coverage-report-with-jacoco-in-azure-devops-pipeline-395558712977
  2. https://www.lambdatest.com/blog/reporting-code-coverage-using-maven-and-jacoco-plugin/
Vikash
  • 1