Marko Integrated Code Coverage Platform: Architecture, Features, and Technical Solution
The Marko integrated code‑coverage platform, presented by vivo’s front‑end team, offers a zero‑intrusion, one‑click solution that collects and merges multi‑language coverage data during integration testing, visualizes incremental reports and diffs through a three‑layer architecture, supports Git and OAuth, provides real‑time dashboards and alerts, and is slated for broader language support and open‑source release.
This article, based on Song Jiachao’s talk at the 2021 vivo Developer Conference, introduces the Marko integrated code‑coverage platform developed by the vivo front‑end team.
Background : Modern agile projects face short iteration cycles, frequent requirement changes, and high system complexity, which create testing challenges for both developers and testers.
Pain points : Testers cannot pinpoint code changes, leading to exhaustive testing; developers lack visibility into execution data, making it hard to assess which code is exercised or verified.
Solution : A unified code‑coverage platform that collects coverage data during integration testing and visualizes it for developers and testers.
Platform advantages include one‑click integration with zero code intrusion, incremental reports, multi‑language support (frontend and backend), various tools (code diff, git‑blame), multi‑user real‑time merging, dashboard monitoring, notification alerts, and optional private deployment.
Technical architecture is divided into three layers:
Access layer – provides language‑agnostic instrumentation, environment differentiation, and intelligent reporting. It already supports Web and is extending to mini‑programs, Node.js, TypeScript, Go, Java, etc.
Service layer – handles report management, user management, project management, and merges coverage data.
Presentation layer – visualizes coverage, trends, and detailed diff views.
Instrumentation follows four dimensions: statement, function, branch, and line coverage. The JavaScript instrumentation uses istanbul-lib-instrument to inject probes, captures relative file paths, and adds custom metadata.
Reporting collects coverage and project metadata, then sends it via environment‑specific hooks (e.g., VisibilityChange for web, onShow/onHide for mini‑programs, scheduled tasks for server‑side).
Report merging handles unchanged files and changed files, aligning line numbers across versions and consolidating multiple user reports.
Git integration retrieves change sets via APIs (e.g., GitLab compare) to associate coverage with actual code modifications.
User management employs OAuth to support GitHub, GitLab, Gitee, enabling seamless login and permission handling.
Future plans include expanding language support (frontend: mini‑programs, Node.js, TypeScript; backend: Go, Java) and open‑sourcing the entire platform.
The article concludes that code coverage is a valuable metric for testing quality but should complement, not replace, well‑designed test cases.
vivo Internet Technology
Sharing practical vivo Internet technology insights and salon events, plus the latest industry news and hot conferences.
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.