2

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?

gigomar
  • 75
  • 2
  • I undertand that, but in previous version it was considering as covered, and in xCode it was shown in red/white stripes, showing that it is not fully covered. Also, I performed a test, and using ternary operator, it is shown as covered even if not both conditions are satisfied, like `let a = b ? 1 : 0` – gigomar Oct 04 '21 at 13:29
  • We are also facing the same issue with Xcode 13.2.1 – arango_86 Feb 21 '22 at 16:10

1 Answers1

1

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.

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • 1
    I don't think it's only rendering, because I'm using slather (with profdata) to generate cobertura report to integrate with sonar, and it's not showing the lines as covered as well. It made a significant decrease of coverage in my project even tough lines are at least partially covered – gigomar Oct 11 '21 at 16:39