Code coverage broken in Xcode 14.2?

Hi,

My team is in the process of upgrading from Xcode 13 to Xcode 14 for our development. Today I noticed that our code coverage reporting in Xcode is showing a clearly incorrect result: 0.0% when it should be saying a significantly higher number based on Xcode 13's calculations also run today. We have now reproduced the 0.0% issue on two different computers. Has anyone else noticed something like this? It looks like coverage is being reported just fine for our CocoaPods, but not for our internal targets.

This is a predominantly-Swift codebase.

In the Build Settings, I've tried setting "Enable Code Coverage Support" to true and "Generate Legacy Test Coverage" to false for our main target even though previously "Enable Code Coverage Support" was only true for the test target; however that does not make a difference. xcodebuild yields the same results when I attempt to generate a .xcresult from the command line.

Thank you in advance for any guidance you might be able to provide me on this.

Answered by sstigler in 759269022

Update on this: I found that a 3rd-party library somehow was causing the issue. Removing the library caused coverage to start working again.

Hey there 👋

We recently ran into what sounds like the same issue with errant 0% coverage reports from Xcode 14.2's llvm-cov. Since you posted, you may have already figured out that Xcodes 14.1 and 14.3 don't have this issue. FWIW, Xcode 14.3 release notes mention a group of resolved issues this might have been a part of, otherwise I haven't seen another internet mention of the issue.

Fixed: A number of Swift code coverage bugs have been fixed. Most notably, code coverage should now correctly work in -O builds. (100327359)

Cheers

Thanks! I tried updating to Xcode 14.3 but that did not fix the issue for me; will continue to investigate.

Accepted Answer

Update on this: I found that a 3rd-party library somehow was causing the issue. Removing the library caused coverage to start working again.

Code coverage broken in Xcode 14.2?
 
 
Q