microsoft / codecoverage

MIT License
84 stars 11 forks source link

Merging two cobertura xml files loses timestamp? #127

Closed StefH closed 3 months ago

StefH commented 4 months ago

Using this command:

dotnet-coverage merge TestResults\**\In\**\*.cobertura.xml -o TestResults\merged.cobertura.xml -f cobertura

And the two source cobertura xml files:

First file:

<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.8602" branch-rate="0.7204" version="1.9" timestamp="1721798508" lines-covered="2431" lines-valid="2826" branches-covered="616" branches-valid="855">
  <sources>
  . . .

Second file:

<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.8501000000000001" branch-rate="0.7706000000000001" version="1.9" timestamp="1721799344" lines-covered="3115" lines-valid="3664" branches-covered="625" branches-valid="811">
  <sources>
  . . .

Merged file:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<coverage line-rate="0.8545454545454545" branch-rate="0.7478787878787879" complexity="2611" version="1.9" timestamp="0" lines-covered="5546" lines-valid="6490" branches-covered="1234" branches-valid="1650">
  <sources>
  . . . 
fhnaseer commented 4 months ago

Yes, seems like a bug. Have you tried other tools to merge cobertura reports? Which timestamp (first file or second file) is used in the merged report?

StefH commented 4 months ago

I did not test other merge tools yet. Which ones do exist?

fhnaseer commented 4 months ago

I checked ReportGenerator. We can generate new timestamp (current time) and use it in the merged report.

fhnaseer commented 3 months ago

It has been fixed and will be available in the next release 17.12.0.