0

I am using sbt-jacoco to calculate code coverage and would like to publish Jacoco test coverage results in Azure DevOps test reports.

Here are my tasks:

  - script: "sbt jacoco"
    displayName: Run Jacoco

  - task: PublishCodeCoverageResults@1
    displayName: Publish code coverage report
    inputs:
      codeCoverageTool: 'JaCoCo'
      summaryFileLocation: $(System.DefaultWorkingDirectory)/target/scala-2.13/jacoco/report/html/index.html
      reportDirectory: $(System.DefaultWorkingDirectory)/target/scala-2.13/jacoco/report

These tasks are executed successfully and the results are shared as an artifact on the pipeline. However, it also throws a warning which is

##[warning]No coverage data found. Check the build errors/warnings for more details.

I would like to see the results in a chart which is attached to the pipeline. Could you please help with this problem?

2 Answers 2

0

It seems your 'summaryFileLocation' property is pointing to the 'html' version of the report while (as per documentation) it should point to the 'xml' version of it

Sign up to request clarification or add additional context in comments.

Comments

0

I found the solution. I needed to adjust the configuration settings following way.

 lazy val jacoco = jacocoReportSettings in Test := JacocoReportSettings(
      "Jacoco Coverage Report",
      None,
      JacocoThresholds(instruction = 10, method = 10, branch = 10, complexity = 10, line = 10, clazz = 10),
      Seq(JacocoReportFormats.ScalaHTML, JacocoReportFormats.XML),
      "utf-8"
    )

  override def projectSettings: Seq[Setting[_]] = super.projectSettings ++ jacocoSettings

and in Azure Pipelines it would be;

  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: 'JaCoCo'
      summaryFileLocation: $(jacocoReportDir)/report/jacoco.xml
      reportDirectory: $(jacocoReportDir)/report/html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.