SlatherOrg / slather

Generate test coverage reports for Xcode projects & hook it into CI.
MIT License
1.55k stars 233 forks source link

Cobertura report shows wrong numbers #520

Open tosbaha opened 1 year ago

tosbaha commented 1 year ago

I have exported the code coverage report with

coverage = JSON.parse `xcrun xccov view --report --json #{test_path}`

It gave a report with something like the below

  "coverage": {
    "coveredLines": 95,
    "lineCoverage": 1,
    "targets": [
      {

It shows that 95 lines are covered which is the actual value since I see the same number on Xcode.

Screen Shot 2022-08-10 at 11 39 44

Then I run the slather

slather coverage -x --scheme FizzBuzzKit Appcircle.xcodeproj

XML report says this

<?xml version="1.0"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="1.0000000000000000" branch-rate="1.0000000000000000" lines-covered="88" lines-valid="88" branches-covered="98" branches-valid="98" complexity="0.0" timestamp="1660117022" version="Slather 2.7.2">

Instead of 95, it is reporting as 88 lines.

I attached the Xcode test result as well. FizzBuzzKit.xcresult.zip

jarrodlombardo-EventBase commented 7 months ago

I was looking at adding a new feature and encountered this when locally running the tests for this project. I'll see if I can fix it and update the tests accordingly.