xcresulttool icon indicating copy to clipboard operation
xcresulttool copied to clipboard

Code coverage report is not showing up

Open denil-ct opened this issue 3 years ago • 15 comments

I had 255 test cases and 77 cases failed I had these errors, is it because of that?

Error: The 'summary' will be truncated because the character limit (65535) exceeded.
Error: The 'text' will be truncated because the character limit (65535) exceeded.
Error: Annotations that exceed the limit (50) will be truncated.

denil-ct avatar Jan 20 '22 13:01 denil-ct

No, that message is irrelevant. That message simply informs you that the report was partially truncated because it exceeded the internal limits of the GitHub Checks API. Strictly speaking, it is a warning message, not an error.

I think the reason why the code coverage is not shown is that the XCResult bundle does not contain coverage. Can you confirm that the test bundle contains the coverage data? Or can you share the test bundle for me to investigate the problem?

kishikawakatsumi avatar Jan 20 '22 19:01 kishikawakatsumi

It does contain it

When I run xcrun xccov view --report --json Example.xcresult I get a json result of code coverage in the terminal

denil-ct avatar Jan 24 '22 11:01 denil-ct

It seems the report generated is cut off I believe when I run massive amounts of test cases only part of them show up in the final detailed output It shows up in the table but gets truncated in the details view As you can see after a certain number of test classes it comes like this and then moves to annotations

image

denil-ct avatar Jan 24 '22 15:01 denil-ct

Oh, that's probably why. GitHub Checks has a character limit, and I think it exceeded that limit just by reporting lots of test failures. That's probably why the test coverage was truncated.

kishikawakatsumi avatar Jan 24 '22 20:01 kishikawakatsumi

I see, Is there any workaround for this? Like can we disable annotations/detailed view and get code coverage instead?

denil-ct avatar Jan 25 '22 04:01 denil-ct

If you set the show-passed-tests: false parameter, only failed tests will be reported, so the display will be slightly increased.

However, the case where so many tests are failing is currently outside the scope of the use case. What kind of behavior are you expecting? Do you only want to see the test coverage?

kishikawakatsumi avatar Jan 25 '22 06:01 kishikawakatsumi

Yes tried with that flag, it improved a little bit, but still not covered all test classes and got cut off in details view Yes an option to disable details section or the annotations section so there is enough space for code coverage results. Ideally we can customize what sections need to be displayed in the end result.

denil-ct avatar Jan 25 '22 06:01 denil-ct

I see. Thanks.

Ideally we can customize what sections need to be displayed in the end result.

Yes, I agreed with you. I plan to do that eventually, but it will take some time because I need to rewrite parsing xcresult into a flexible code.

kishikawakatsumi avatar Jan 25 '22 07:01 kishikawakatsumi

Cool, Thanks for the tool I will try some workarounds for now

denil-ct avatar Jan 25 '22 07:01 denil-ct

I'm seeing the same issue as the OP. Same error, but no other info:

CleanShot 2022-02-08 at 09 51 56@2x

tonyarnold avatar Feb 07 '22 22:02 tonyarnold

@tonyarnold do you mean you are not getting the test results at all or is it like me just cut off in the middle?

denil-ct avatar Feb 08 '22 08:02 denil-ct

My results did show up (although I misunderstood that it overwrites the results if you try to capture more than one xcresult bundle), however they were truncated like yours @denil-ct.

tonyarnold avatar Feb 11 '22 06:02 tonyarnold

Is there anyway the tool can generate an output file that we can upload as an artifact to get around the git word limit?

Dharna avatar Mar 16 '23 14:03 Dharna

@Dharna We decided to go with this tool as it gave a file output that we could then ingest into our systems. This allowed us to overcome the truncation issue. Although, one thing to note is, that tool was not designed for Xcode or iOS development in general, more oriented towards windows, so you might need to install a couple of dependencies as needed.

denil-ct avatar Mar 16 '23 14:03 denil-ct

@denil-ct I see. Yeah I am mainly looking for iOS and macOS report generation. Thank you for the tool! Will take a look.

Dharna avatar Mar 16 '23 14:03 Dharna