coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

[BUG] Getting warning "coverage.cobertura.xml was not found" while publishing unit-test result

Open biswajitsamal59 opened this issue 1 year ago • 9 comments

Describe the bug I am using below dotnet test command to run unit-test and collect code coverage. While publishing the unit-test result using PublishTestResults@2 task getting "coverage.cobertura.xml was not found" warning. When I checked the .trx file which contain unit-test result there is a entry for CollectorDataEntries which is causing this.

To Reproduce Use below dotnet command dotnet test TestApp.Tests.csproj --logger "trx;LogFileName=TestApp.trx" --collect:"XPlat Code Coverage" --settings "..\coverlet.runsettings"

coverlet.runsettings

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat code coverage">
        <Configuration>
          <Format>cobertura</Format>
          <Exclude>[TestHelper*]*</Exclude>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

Publish unit-test result using task: PublishTestResults@2

Expected behavior Code coverage should not interfere with the unit-test result (.trx) file

Actual behavior Unit-test result file has entry like below:

<CollectorDataEntries>
      <Collector agentName="Agent00002T" uri="datacollector://microsoft/CoverletCodeCoverage/1.0" collectorDisplayName="XPlat code coverage">
        <UriAttachments>
          <UriAttachment>
            <A href="Agent00002T\coverage.cobertura.xml"></A>
          </UriAttachment>
        </UriAttachments>
      </Collector>
</CollectorDataEntries>

Configuration (please complete the following information): Please provide more information on your .NET configuration: * Which coverlet package and version was used? 6.0.2 * Which version of .NET is the code running on? net6.0-windows x86 * What OS and version, and what distro if applicable? Windows 10 * What is the architecture (x64, x86, ARM, ARM64)? .Net x86 * Do you know whether it is specific to that configuration? No

biswajitsamal59 avatar Sep 30 '24 09:09 biswajitsamal59