Test: Publish Code Coverage Results

VSTS | TFS 2018 | TFS 2017 | TFS 2015

icon Publishes the code coverage results of a build.


The build agent must have the following capabilities:

  • MSBuild
  • Azure PowerShell


Argument Description
Code Coverage Tool Required. The tool with which code coverage results are generated. Currently supported schemas are Cobertura and Jacoco.
Summary File Required. The path of the summary file containing code coverage statistics such as line, method, and class coverage. The value may contain minimatch patterns. Example: $(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura/coverage.xml
Report Directory The path of the code coverage HTML report directory. The report directory is published for subsequent viewing as an artifact of the build. The value may contain minimatch patterns. Example: $(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura
Additional Files The file path pattern specifying any additional code coverage files to be published as artifacts of the build. The value may contain minimatch patterns. Example: $(System.DefaultWorkingDirectory)/**/*.exec
Control options See Control options

YAML snippet


- task: PublishCodeCoverageResults@1
#   codeCoverageTool: JaCoCo # Cobertura, JaCoCo (default)
#   failIfCoverageEmpty: false

More Information


I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on VSTS and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.

Help and support