Code coverage in pipeline of Azure Devops?


  • Junior Test Automation

    How to enable generating code coverage report after running auto tests in Azure Devops. Is there a good embedded solutions?



  • To publish code coverage results produced when running tests to Azure Pipelines you can use PublishCodeCoverageResults task in yaml file. Popular coverage result formats are Cobertura and JaCoCo:

    # Publish code coverage results
    # Publish Cobertura or JaCoCo code coverage results from a build
    - task: PublishCodeCoverageResults@1
      inputs:
        #codeCoverageTool: 'JaCoCo' # Options: cobertura, jaCoCo
        summaryFileLocation: 
        #pathToSources: # Optional
        #reportDirectory: # Optional
        #additionalCodeCoverageFiles: # Optional
        #failIfCoverageEmpty: false # Optional
    


Suggested Topics