Why code coverage decreased after updating to xcode 13?

Viewed 645

I updated to Xcode 13 and noticed that the coverage report is not considering some lines like guard, ??operator, curly braces...

ex: enter image description here

It made the overall coverage decrease a lot without a change. Is anyone facing this issue? Is there a solution?

1 Answers

I can confirm the behavior you describe.

In Xcode 12.5.1:

enter image description here

It correctly shows that both of these methods only have partial coverage (when, of course, you’re only testing one path of execution).

But Xcode 13.0 suggests no coverage for that nil coalescing scenario, even though it really is partially covered:

enter image description here

Clearly, one should attempt to test both scenarios to ensure complete coverage (at which point Xcode 13 will properly indicate this), but this would appear to be a bug in the rendering of the partial coverage, in certain cases, in Xcode 13.0.

Related