SlatherOrg / slather

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

Report reads little to no coverage #528

Closed Morkrom closed 1 year ago

Morkrom commented 1 year ago

I am outputting reports to code climate using their uploader and with the specified cobertura xml format. The test results are generated by fastlane 'scan' tool. Results are posted successfully, however the total coverage reads as less than 1%. Effectively all the files which I have test coverage for, display 0% coverage. Conversely, standalone files for whom there is no coverage, show coverage numbers. I am able to view coverage when using Xcode, which is around 10%. That's the number I expect to see in the cobertura report.

Here's an example of the 'scan' usage:

scan(device: destination, scheme: target_name, clean: should_clean, only_testing: "Tests", fail_build: false )

And here is the slather command:

slather( scheme: "Scheme", workspace: "Scheme.xcworkspace", proj: "Scheme.xcodeproj", cobertura_xml: true, ignore: "ignored_directories")

I have "gather test coverage for all targets" enabled for the main app scheme. Not for the test app scheme. All I have tried making the scan command simpler by "only_testing" a single target. I have also tried specifying the binary-basename, with the name of the main app target.

Is this a known issue for anyone else, where file coverage percent is generally reported as 0?

Morkrom commented 1 year ago

This was my user error and of Fastlane, not Slather: When relying on the artifact from Fastlane scan tool to report coverage, you must specify:

code_coverage: true

Morkrom commented 1 year ago

Additional note, I did need to use the:

--binary-basename

with the argument of the target name.