-
Notifications
You must be signed in to change notification settings - Fork 274
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
State of code coverage? #338
Comments
@allevato likely knows the most about this. |
Indeed, the coverage support in the rules is currently for 🤫 internal use 🤫 at this time. I'm not too up-to-date on the current state of Bazel coverage. Bazel parses |
Is that the only thing missing from making this work externally? (It seems like the rules and test runner might also need some changes?) |
It looks like the version of |
Any update on this ticket? Looking to start trying to surface some coverage on my Bazel project. I would believe this would be supported if the last ticket was from the xcode 11 beta |
We have this working on our project internally, but we have a custom test runner to do so. But I can outline the gist of how it works here:
A few gotchas:
|
Thank you @keith for these tips, I used them alongside this blog post to put together a sample app that uses Coveralls to show test coverage with Bazel https://github.com/tinder-maxwellelliott/ios-bazel-test-with-coverage This approach works fine when you only have 1 unit test suite. In the real world you will have several, to make sure to get coverage for all of them you would need to:
|
Nice example. Note in general you should prefer FWIW I think we should update the test runner in this repo to at least have some minimal amount of coverage support, so if you'd like to submit a PR for that I'd be happy to review it! |
Does I will have to familiarize myself with the test runner. I would love to assist |
Yes it does, here are the docs https://docs.bazel.build/versions/master/command-line-reference.html#coverage Here's a small PR with that update tinder-maxwellelliott/ios-bazel-test-with-coverage#5 But unrelated to that, by doing coverage correctly in the test runner instead you could avoid grabbing the binary from the bazel-bin as you have to there, also you wouldn't have to disable sandboxing, since the test runner would have access to everything it needed and can write files to Also depending on your use case you might actually want a |
This is definitely the best option possible. Having everyone do this manually when we have everything we need already in the test runner is wasteful. I will read through it and see what I can accomplish |
Where is the best place to start looking into this kind of an addition? |
I think the changes could be entirely localized to this shell script https://github.com/bazelbuild/rules_apple/blob/master/apple/testing/default_runner/ios_test_runner.template.sh |
Looking into this more. I can see that |
|
Just to link here all coverage related information, some work has been merged in Bazel here. Maybe we could see better coverage support with bazel 4 |
Can folks who are interested test out #1223 You'll still need to pass But this generates a lcov file for consumption |
Note you also have to pass |
with bazelbuild/bazel#14724 it seems like progress is being made on this and may no longer require |
I've been looking through bazel/rules_apple/apple_support/rules_swift and it appears that there's a decent amount of integration for supporting code coverage that could work for iOS. But it seems like some critical pieces are not hooked up, like empty filegroups, stub binaries and variables that wouldn't be passed through to iOS tests.
What's the plan with supporting code coverage for iOS? Is this something that's already supported inside of Google but not in the public for some reason?
The text was updated successfully, but these errors were encountered: