Targeted Code Coverage Reports For Android Continuous Builds
Article Summary
Brian Terczynski from Thumbtack reveals how their Android team solved a critical problem: developers couldn't see which specific lines in their code changes lacked test coverage. The solution? Two custom reports that pinpoint exactly where tests are missing.
Standard code coverage tools show overall codebase coverage, but they don't highlight what matters most during code review: which new or changed lines need tests. Thumbtack's Android team built lightweight Python scripts (150 lines each) that integrate with their CI pipeline to generate targeted, actionable coverage reports for every pull request.
Key Takeaways
- CR-specific coverage shows exactly which changed lines lack tests
- Coverage delta report reveals if PRs regress overall codebase coverage
- Custom 150-line Python scripts integrate with Jacoco and existing CI tools
- Team achieved >1% daily coverage increases during focused test-writing sprints
- Authors now proactively add tests after seeing targeted reports
Thumbtack's targeted coverage reports make it immediately obvious which lines need tests, leading to measurably more unit tests in code reviews and sustained coverage improvements.
About This Article
During code reviews, Thumbtack developers couldn't easily see which parts of their code weren't being tested. This made it hard to figure out what tests needed to be added to pull requests.
The Android team at Thumbtack built Python scripts that combined Jacoco coverage reports with Git diff data. This let them create coverage reports specific to each code review and track how coverage changed compared to the parent commit.
With these targeted reports, engineers added missing unit tests and achieved over 1% coverage increases per day during test-writing sprints. Authors started updating their pull requests on their own after reviewing the reports.