Code Coverage Statistics Platform: Architecture, Implementation, and Usage in JD Mobile App
This article introduces JD's code coverage statistics platform, detailing its concepts, significance, implementation approaches for Android and iOS—including Jacoco and Xcode configurations—its SDKs, data collection, reporting mechanisms, and how it enhances testing quality and development efficiency.
JD's code coverage statistics platform, created by the main App's golden‑process R&D team, provides lightweight SDKs, analysis systems, visual management, automated reports, and data analytics to assist regression testing, quantify test data, and improve test quality.
Code Coverage Concept and Significance – Code coverage measures the proportion of source code executed by tests, serving as an indicator for unit‑test effectiveness, regression progress, and overall code quality. It helps guide test case creation, digitize testing processes, and identify blind spots.
Implementation方案
Android – Uses Jacoco, an open‑source Java coverage tool, with two instrumentation modes: on‑the‑fly (javaagent) and offline (instrumented class files). JD primarily adopts the offline mode, embedding probes during compilation and uploading instrumented files to the server for later analysis.
iOS – Evaluates market solutions and builds a custom workflow. Xcode build settings enable coverage file generation:
GCCGENERATETESTCOVERAGEFILES = YES</code><code>GCCINSTRUMENTPROGRAMFLOWARCS = YESThe JDWorkSpace Mac client retrieves instrumented files and creates static libraries. JDCodeCoverRateModule offers a visual UI for collecting operation files, supporting drag‑and‑drop, data compression, upload, and cleanup.
LCOV is used to generate iOS coverage reports, and incremental coverage is derived by collecting full coverage, computing code diffs, and filtering for changed sections.
Coverage Scanning Platform Overview
The platform consists of five components: coverage SDK, analysis engine, assistance system, visual management platform, and automated report push. The SDK provides one‑click integration with minimal intrusion, packaged as Gradle plugins for Android and Xcode settings for iOS.
The analysis engine handles access management, task parsing, workspace creation, branch handling, report generation, data storage, and messaging. Administrators configure modules, repositories, and version information, triggering workspace setup, code cloning, pre‑compilation, and instrumentation.
Task scheduling processes uploaded coverage files, stores them in the cloud, matches them to workspaces, and runs platform‑specific scripts to generate full and incremental reports. Data services store module, version, branch, and coverage information, offering dashboards for test progress, PV, and other metrics, with email and instant‑messaging notifications.
Coverage Assistance System
To help testers improve coverage, the system captures online data, caches, filters, mocks, and executes it. It integrates with JMQ for data collection, configures monitoring interfaces, and provides mock data insertion to trigger uncovered code paths, thereby raising coverage percentages.
Conclusion
The platform is already deployed in JD's main app modules (order, checkout, cart, etc.), supporting both full and incremental reports, intelligent data capture, and mock integration. Future phases will refine the UI, enhance automation, and further automate coverage improvement.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JD Retail Technology
Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
