Combining code coverage reports from FTL and unit tests

Satyajit Malugu
Feb 9, 2018 · 1 min read

Following up on my previous post https://medium.com/mobile-testing/generating-code-coverage-from-espresso-tests-running-in-firebase-test-lab-e98edcea7bdf where we saw about generating code coverage numbers for espresso tests running in FTL, this post looks at how to combine them.

This is not a new idea, I am borrowing a lot from https://medium.com/@rafael_toledo/setting-up-an-unified-coverage-report-in-android-with-jacoco-robolectric-and-espresso-ffe239aaf3fa but customizing it our CI/CD pipeline.

Assuming that your coverage.ec file is already created on gcloud you need to find a way fetch it down. gsutil is the most straightforward way. So I have something like this

Note: bucket name has to be unique and should be identifiable for our setup we just reuse the job name.

As a final step we have a createReports task which has jacocoPublishser like this

The most important thing here is that excePattern is able to merge the coverage.ec file created from FTL into your jacoco report.

mobile-testing

Posts about mobile automation and testing

Satyajit Malugu

Written by

mobile-testing

Posts about mobile automation and testing