-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Firebase Test Lab example that demos Jacoco support #165
Comments
If Firebase team adds this feature, I will be happy to tested :) |
Try out this blog post shared by @bootstraponline |
@shobhitagarwal1612 good tutorial, but @bootstraponline wants to integrate Jacoco codecov reporting with Firebase Test Lab runs. |
Jacoco on Firebase Test Lab works today. There's no official sample though. I think it'd help if Google maintained one. |
I wrote these posts
Did they no work? @bootstraponline how is your setup different? |
These samples are for the Android Testing Support Library. Firebase and Jacoco are outside of that scope. We use FTL in android-architecture though. |
Yeah, they work. Was hoping for something Google maintained. Sounds like that's the Android architecture repo. |
Anyone figure this out? I'm trying to retrieve Jacoco code coverage reports of test app instrumentation tests run in a Firebase emulator and then passing those reports on to codecov.io |
@langsmith Where you able to find a solution to the issue? I'm struggling with the same thing |
Nope, haven't solved it yet @sblepa 😞 I think I've read every official documentation page, Github thread, Stack Overflow post, and blog post related to some mix of Jacoco, CircleCI, Firebase, Codecov. 😄 Searching for others' code on Github also didn't really turn up anything. Nothing out there that covers the integration of all four together though 😢 |
I was able to get Firebase, Jacoco, and Codecov to play nicely together for merged unit test and instrumentation test coverage. If you run into any issues following what I did, feel free to post them and I'll try to help. https://github.com/Rajawali/Rajawali If you read through the circle config you'll find the block for generating the androidTest apk and then passing it to Firebase for execution. After execution, the coverage report is copied back and then a custom gradle task is run for merging the previously run unit test coverage with the instrumentation test coverage. After that, codecov works as expected. Note this leaves out several important pieces of information such as creating the dummy apk which is still a requirement for library projects presumably because no one at firebase has ever bothered trying to use test lab from a CI environment. The dummy apk, as documented in various SO posts and github issues, needs to have a main activity, permissions to write to the sd card, and must have test coverage enabled in the gradle config. Next, you need to set up a service account in your google api console which I would love to explain here but that's about 156 "simple" steps that really needs an entire blog post to explain. Finally, if you follow any of the articles about unifying code coverage you may find they do not work for you depending on your build setup. In my case Going forward, I'll work on rolling the gcloud calls into gradle so that the build script can lose some weight but for now it is what it is. Additionally, this setup will only work when testing against a single device. The gcloud copy calls can be tweaked to work around that I just haven't gotten to it yet. To any Googlers reading this, can you please help us out and document this process? It's a bit insane that it's this much work to figure out how to use tools you make us pay for (re Firebase for any appreciable amount of testing). The fact that everyone, myself included, has to piece this all together from a variety of blog posts, SO posts, and github issues would make me feel embarrassed if I was on teams associated to these tools. CI is an obvious use case and we are left entirely to ourselves to tape it together. |
https://github.com/TestArmada/flank#android-code-coverage This is the documentation I created after lots of trial and error. Hope it's useful. 😄 |
@prolificcoder |
@nikitha2 you can't open it but I recall that coverage programs can read the binary/raw format. |
I've written an article at https://proandroiddev.com/android-code-coverage-on-firebase-test-lab-part-1-the-basics-9e1492ec5399 that might be helpful, especially if you're trying to get this working for API 30. The corresponding sample project is at https://github.com/Aidan128/CoverageExample1/ @nikitha2 it also covers how to generate reports from a downloaded .ec file. |
It'd be nice to have an example of running Espresso on Firebase Test Lab with Jacoco code coverage support.
The text was updated successfully, but these errors were encountered: