Thumbtack Brian Terczynski Dec 2, 2019

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

Critical Insight

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.

The article includes specific examples of how reviewers now give more precise feedback and why the team chose to build custom scripts instead of using third-party tools.

About This Article

Problem

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.

Solution

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.

Impact

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.