Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code coverage report not matching Xcode test results #146

Open
sigsbeym opened this issue Oct 20, 2024 · 3 comments
Open

Code coverage report not matching Xcode test results #146

sigsbeym opened this issue Oct 20, 2024 · 3 comments

Comments

@sigsbeym
Copy link

I'm using this with some swift packages I've been working on and they are not reporting coverage results that match what I see in my Xcode project when running tests. It looks like it's including coverage for dependency targets, which is reducing my total coverage percentage significantly, and Xcode is not doing this.

When I use swift test --enable-code-coverage via cli I also see this reduced total coverage amount, but when I use xcodebuild the xcresult file coverage totals match what I see in Xcode.

I tried modifying this action to fallback to the xcodebuild commands that are already being used in the action for project/workspace files, but somehow it's also not matching Xcode test coverage. I think there's something with how the results are being parsed out of the xcresult file by the dd sdk testing framework that I can't see in the action logs which is causing this irregularity.

Any help or guidance would be appreciated.

@ypopovych ypopovych transferred this issue from DataDog/swift-test-action Oct 23, 2024
@ypopovych
Copy link
Contributor

Hello @sigsbeym.

Yes. Xcode filters code coverage by target and SDK reports shared.

SDK simply doesn't know which targets to filter, so calculates it for all test process binaries which built with code coverage.

@sigsbeym
Copy link
Author

@ypopovych Is there not a way to specify this to the SDK? I know that's not possible with swift cli, but xcodebuild seems to work fine if I supply it with a test plan. It doesn't seem like this is an option with your SDK even when using the xcodebuild command.

@ypopovych
Copy link
Contributor

@sigsbeym Xcode doesn't send test plan info to the test process (only tests to filter). It gathers all info and at the end filters it by itself. That's why swift cli shows different percentage.

Right now we don't have option to filter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants