SlatherOrg / slather

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

Different coverage percentage from XCode report #557

Open domenicontt opened 1 month ago

domenicontt commented 1 month ago

Hi Team, The report generated by slather provides coverage percentages that are far different from those provided by XCode. For many swift classes that have 100% coverage with XCode, slather reports zero coverage. Any suggestions to solve this problem? Thanks!

jarrodlombardo-EventBase commented 1 month ago

Need more details. Is Slather printing any warnings or errors when you run it?

domenicontt commented 1 month ago

Hi, sorry for the lack of details in the previous comment. During slather running I don't have any errors or warnings. My project uses XCode 15.2 and Swift 5. Thanks!

jarrodlombardo-EventBase commented 1 month ago

Still not enough details for me to investigate anything. Can you copy the log from XCode that does code coverage and also the log from your slather run?

victor-livefront commented 1 month ago

FWIW I've also seen inconsistencies between what Slather is reporting vs what Xcode is reporting. I was seeing partial coverage on a few files not being reported. Played around with my slather configuration for a little bit, but didn't have any luck. To circumvent the issue, I moved our CI coverage reporting over to Xcov from Slather, and the reporting is now 1-1 with Xcode. Here's a screen shot of an example of what wasn't covered (just the initializer in this file, everything else was covered). Didn't see any warnings or errors in the console when generating Slather reports. We're also on Xcode 15.2 now, but we've been seeing the problem for a few months and also used Xcode 15.0.

image