Azure-devops-docs: One code coverage result from many test's project in solution

Created on 14 Jun 2018  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

Is it possible to compose one coverage result from many coverage.cobertura.xml files?
Now have a issue like Multiple file or directory matches were found. Using the first match: D:\TFS\...\coverage.cobertura.xml


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devopprod

Most helpful comment

The product team tell me that merging multiple cobertura xml files is currently not supported. However, we are taking up work to evolve code coverage integration in VSTS, and will evaluate this in Q3 of 2018.

All 6 comments

Thank you for your feedback. I have passed this on to the product team for advice.

The product team tell me that merging multiple cobertura xml files is currently not supported. However, we are taking up work to evolve code coverage integration in VSTS, and will evaluate this in Q3 of 2018.

Hi, any plans on the above feature request? thanks.

The product team tell me that merging multiple cobertura xml files is currently not supported. However, we are taking up work to evolve code coverage integration in VSTS, and will evaluate this in Q3 of 2018.

ReportGenerator can merge multiple coverage files into one, e.g. merge several Cobertura XML files into just one Cobertura XML file, as seen here.

Here is an Azure Pipelines fragment used for generating coverage files in Cobertura format for a series of unit and integration tests run via xUnit and coverlet:
````yaml

  • task: DotNetCoreCLI@2
    displayName: Run unit tests
    name: run_unit_tests
    enabled: True
    inputs:
    command: custom
    custom: test
    projects: ./Tests/UnitTests/TodoWebApp.UnitTests/TodoWebApp.UnitTests.csproj
    arguments: '--configuration ${{ parameters.build.configuration }} --test-adapter-path "." --logger "xunit;LogFilePath=$(Build.SourcesDirectory)/.TestResults/TodoWebApp.UnitTests.xunit.xml" /p:CollectCoverage=True /p:CoverletOutputFormat=cobertura /p:CoverletOutput="$(Build.SourcesDirectory)/.CoverageResults/TodoWebApp.UnitTests.cobertura.xml"'
  • task: DotNetCoreCLI@2
    displayName: Run integration tests
    name: run_integration_tests
    enabled: True
    inputs:
    command: custom
    custom: test
    projects: ./Tests/IntegrationTests/TodoWebApp.IntegrationTests/TodoWebApp.IntegrationTests.csproj
    arguments: '--configuration ${{ parameters.build.configuration }} --test-adapter-path "." --logger "xunit;LogFilePath=$(Build.SourcesDirectory)/.TestResults/TodoWebApp.IntegrationTests.xunit.xml" /p:CollectCoverage=True /p:CoverletOutputFormat=cobertura /p:CoverletOutput="$(Build.SourcesDirectory)/.CoverageResults/TodoWebApp.IntegrationTests.cobertura.xml"'

  • script: 'reportgenerator "-reports:$(Build.SourcesDirectory)/.CoverageResults/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/.CoverageResults/Report" "-reporttypes:Cobertura;HtmlInline"'
    displayName: Generate code coverage report
    name: generate_code_coverage_report
    enabled: True
    ````

The resulted file will be created here: $(Build.SourcesDirectory)/.CoverageResults/Report/Cobertura.xml and the build dashboard will include coverage from both types of tests, unit and integration.
The full Azure Pipelines YAML file can be found here.

The product team tell me that merging multiple cobertura xml files is currently not supported. However, we are taking up work to evolve code coverage integration in VSTS, and will evaluate this in Q3 of 2018.

any updated ?

@alexhomer1 - it appears that closing this was premature. This issue is still needed. Would you prefer duplicate issues be created?

Was this page helpful?
0 / 5 - 0 ratings