How jCover Boosts Java Backend Test Coverage in Agile Environments
This article explains how the internally built jCover tool helps a fast‑moving Java backend team measure and improve test coverage across full‑stack, incremental, and parallel testing scenarios, addressing common challenges of agile development, tool limitations, and quality assurance.
Part.1: Challenges of Test Coverage
Test coverage is a key metric for assessing the completeness and effectiveness of testing, especially in agile projects with rapid iteration. In large‑scale transaction services, increasing business complexity and system interactions make it hard to ensure all code is exercised, leading to missed bugs and production incidents.
A real incident occurred when a Sonar scan failure prompted a developer to refactor code, unintentionally breaking a coupon‑issuing feature that was not covered by tests, causing a one‑hour outage.
Common problems with third‑party coverage tools include:
Most focus on pre‑release unit test coverage and lack support for post‑release testing.
They present overall coverage, while testers need insight into newly added or modified code.
They do not support parallel testing across multiple isolated environments.
To overcome these gaps, the team decided to develop a custom coverage solution.
Part.2: Design of the Coverage Tool
The tool, named jCover , targets Java backend services and aims to collect coverage data for various test types (manual, regression, API, UI automation). It supports full‑stack and incremental coverage, parallel testing across multiple environments, and both automatic and manual operation with a simple UI.
jCover is integrated into the CI/CD pipeline via the internal MONE platform, as shown in the architecture diagram:
The coverage workflow retrieves service configuration, generates coverage files for each environment, produces full and incremental reports, and stores them in designated directories.
Part.3: Core Features and Implementation
1. Platform‑style UI – Users can manually generate and query reports through a unified interface that visualizes covered (green), uncovered (red), and partially covered (yellow) lines.
2. Parallel testing across isolated environments – Each test project is identified by an isolation tag, environment type, and service name, ensuring reports from different branches do not overwrite each other.
3. Full‑stack coverage – The process includes querying service info from MONE, collecting coverage dumps via a JavaAgent, merging class files with dumps, and generating a comprehensive HTML report.
4. Incremental coverage – By diffing the master branch with the test branch, jCover isolates changed Java files, marks added lines with "+++" and updated lines with "U", and produces an incremental report highlighting coverage of the new code.
5. Manual and automatic statistics – Testers can trigger coverage generation on demand, while the deployment system can invoke an API to collect coverage automatically after each service restart, ensuring no data is lost.
Part.4: Tool Impact
Supports diverse test types – manual, API, regression, UI automation.
Detects missed code – uncovered lines prompt new test cases.
Identifies redundant code – unused methods are removed.
Improves testing efficiency – early detection of configuration issues.
Provides data for release approval – reviewers focus on uncovered sections.
Enhances tester familiarity with code .
Part.5: Future Plans
The team is adding incremental coverage percentage metrics and exploring front‑end coverage collection, aiming to extend jCover to JavaScript/HTML UI code.
While high coverage does not guarantee quality, combining coverage data with thorough test case design and code reviews helps mitigate risk and improve overall software quality.
Mafengwo Technology
External communication platform of the Mafengwo Technology team, regularly sharing articles on advanced tech practices, tech exchange events, and recruitment.
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.
