Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most Java projects, use JaCoCo to collect coverage during Maven or Gradle test runs, then inspect its report for missed lines and decision branches. IntelliJ IDEA’s coverage runner is useful for interactive, local inspection. Coverage shows what code ran—not whether tests would catch defects—so use the results to find risk-relevant behavior that still needs tests, rather than chasing a universal percentage.

Choose a Java coverage tool for your workflow

Need Practical option What to know
Repeatable Gradle reports and build checks Gradle JaCoCo plugin Integrates with test tasks, provides the jacocoTestReport task, and supports rule-based verification. The report task does not run tests for you. Gradle JaCoCo Plugin documentation.
Maven test and report workflow JaCoCo Maven plugin Attaches the coverage agent and can create reports. Surefire or Failsafe must run tests in a fork that permits the agent; the documented setup cannot collect coverage with forkCount=0 or forkMode=never. Source-line mapping requires debug information. JaCoCo Maven documentation.
Interactive local inspection IntelliJ IDEA coverage runner Can show project, class, method, line, and branch information depending on runner and settings. Branch coverage is available with JaCoCo or with the IDEA runner when branch coverage is enabled. IntelliJ IDEA code coverage documentation.
One HTML report across Gradle subprojects Gradle JaCoCo report aggregation plugin Aggregates coverage data from multiple Gradle projects into a combined report. Gradle JaCoCo report aggregation documentation.

JaCoCo is a practical default when you need build-integrated reports or CI checks; choose an IDE runner when the immediate goal is to explore execution while working locally. For a multi-module Gradle build, aggregation can provide a combined view. Compare tools by build integration, metric detail, local visualization, aggregation needs, and whether instrumentation works with your test execution setup—not by assuming one tool is best for every project.

Measure coverage with JaCoCo

1. Decide what the report should include

Choose the production code scope first: which modules or source sets count, and whether unit and integration tests should be reported separately or together. Keep the scope consistent when comparing reports over time. Generated code or legacy areas may need separate treatment when setting verification rules.

2. Enable JaCoCo in the build

For Gradle, apply the JaCoCo plugin alongside the Java plugin as appropriate for the project. Gradle’s documentation summarizes it this way: “The JaCoCo plugin provides code coverage metrics for Java code via integration with JaCoCo.” For Maven, configure the JaCoCo Maven plugin for the test workflow. Use the official Gradle setup documentation or JaCoCo Maven documentation to match the project’s build and plugin versions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Nicpro Mechanical Carpenter Pencils for Construction (Black, Red) With Case| Deep Hole Marker Pencil Set Includes Sharpener and 26 Refills, Comfortable Grip, Heavy Duty Woodworking Tools for Architect
  • Valued Carpenter Pencil Set: You will get 2 pcs solid carpenter pencils with 26 piece 2.8 mm refills, 1 replaceable sharpener, 1 plastic storage box.The complete carpenter pencils combination allows you to finish your work faster and more easily
  • Deep Hole Marker Pencil: The deep-hole construction pencils adopts 45mm elongated tip design, which is more convenient to mark in the small hole or in other tight areas that other carpenter markers cannot reach
  • Carpenter Pencils with Sharpener: The sharpener is screwed into the top of the work pencil, which won't get lost either. Built-in pencil sharpener that keep the lead with pointed and smooth to Improves line of sight in fine work
  • Stronger Solid Lead: This work pencil is matched with a 2.8 mm thick lead , which is much thicker and stronger during the drawing process of construction work, it will not break or damage easily
  • Marks on Various Surfaces: 3 colors solid construction pencil can marks on various surfaces,such as metal, plastic, wood, paper etc. Ideals for woodworkers, contractors, craftsmen, builders, merchants and masons

3. Run tests with instrumentation active

Execute the test task or Maven test lifecycle that has the coverage agent enabled. In Maven’s documented Surefire/Failsafe setup, tests need a forked process for agent collection; disabling forking with forkCount=0 or forkMode=never prevents collection. If the execution-data file is missing, first confirm that tests actually ran in the expected task and that the agent was attached to that process.

4. Generate and open the report

In Gradle, run tests before jacocoTestReport: that report task does not automatically depend on the test task. The default HTML report location is build/reports/jacoco/test/html. Maven report examples place output under target/site/jacoco. Keep XML output in CI when downstream tools need machine-readable coverage data.

5. Investigate missed behavior

Open the report and examine missed lines and branches in context. Add tests for meaningful boundaries, error conditions, state transitions, and important decision outcomes. A green line is not a goal by itself: a test can execute code without checking whether the result is correct.

Rank #2
Sale
DEWALT 20V MAX Cordless Drill and Impact Driver, Power Tool Combo Kit , Includes 2 Batteries, Charger and Bag (DCK240C2)
  • Ergonomically Designed: Work in tight areas with a compact design that gets into tough spots
  • Compact and Lightweight: Both tools are designed to fit into difficult to reach spaces. The 1/4" impact driver has a length of 5.55 in. and weighs just 2.8 lbs, while the 1/2" drill/driver measures only 7.5 in. and weighs 3.6 lbs
  • Both the DEWALT impact driver and electric drill driver feature integrated LED work lights with a convenient 20-second delay, ensuring enhanced visibility in dimly lit or challenging work areas
  • One-Handed Loading - Keep one hand free with a 1/4 in. hex chuck that accepts 1 in. bit tips
  • Power drill cordless with 1/2" single sleeve ratcheting chuck provides tight bit gripping strength, making bit changes faster and more secure

6. Add project-specific verification when useful

JaCoCo verification rules can make a build fail when configured coverage rules are violated. Set a threshold that suits the code scope and the cost of useful tests; the tool documentation does not prescribe one universal target. Apply rules deliberately around generated code, legacy components, and modules with different risk profiles.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand the coverage numbers

JaCoCo measures Java bytecode instructions as its smallest unit, then reports additional counters that summarize execution at other levels. The metric definitions matter because a single percentage can conceal untested outcomes.

  • Instruction coverage: counts bytecode instructions executed. Compiler-generated instructions mean this is not simply a source-line count.
  • Line coverage: maps execution to source lines when debug line information is available. A line counts as covered if at least one instruction assigned to it executes.
  • Branch coverage: records outcomes of branches associated with if and switch. Exception handling is not counted as branch coverage in JaCoCo’s counter definition.
  • Method and class counters: provide broader summaries of whether methods or classes had execution.
  • Complexity counters: estimate complexity and missed complexity. Missed complexity can point to code worth inspecting, but it remains a metric rather than proof of test quality.

Line and branch coverage answer different questions. A conditional line may execute while only one outcome has been exercised; branch coverage can reveal that gap. IntelliJ IDEA can mark partial conditional execution and show covered versus total branches, subject to the selected runner and settings. See the JaCoCo counters documentation and IntelliJ coverage documentation.

Rank #3
Sale
Push to Unlock,Katerk 6pcs 1/4 inch Hex Shank Aluminum Alloy Screwdriver Bit Holder Light-Weight Quick-Change Extension Bar Keychain Drill Screw Adapter Portable,Black Carabiner,Tool Gifts for Men
  • 【Great Compatibility】This Katerk 1/4 inch hex shank bit holder is specifically designed for 1/4 inch hex shank drill bits. It's compatible with most 1/4 fast hex handles, hex sockets, various electric screwdrivers, and handheld screwdrivers. The bit holder makes it a valuable addition for any handyman.
  • 【Secure and Safe】Built with a secure backup nut design, each drill bit holder securely locks onto your bits, ensuring they stay firmly in place. Additionally, our bit holder incorporates a high-quality steel ball rolling design that holds up to several kilograms of weight, ensuring your various drill bits don't fall off.
  • 【Easy One-Handed Operation】The bit holder for impact driver allows you to change bits single-handedly, simplifying your workflow. Its multi-color design further allows for quick identification of the drill bit you need.
  • 【Compact and Convenient】Thanks to its compact size, this 1/4 inch bit holder is easy to carry around. The bit holder allows for easy attachment to various tools, making this a convenient addition to your construction accessories. The Katerk bit holder is cast from high-quality alloy material, promising a long product lifespan. Despite its rugged strength, the bit holder remains lightweight, making it portable.
  • 【Cool Christmas Gift For Men Stocking Stuffers】 This screwdriver bit holder, driver bit holder, impact bit holder, can be given as a gift to your loved one, especially for anyone involved in construction or electrical work. It's a must-have for stocking stuffers for men and women, tools gifts for dad, tech gadgets for men, gifts for dad, gifts for him, gifts for husband, gifts for boyfriend, cool gadgets for men, and cool gifts for dad.

Use reports in CI and multi-module builds

Make data collection and report generation explicit in the CI workflow: run the instrumented tests, generate the report, then publish the report or preserve its XML output for later processing. For Gradle multi-project builds, the JaCoCo report aggregation plugin can combine subproject coverage into one HTML report. Confirm that the aggregated inputs represent the test runs and code scope you intend to measure; a combined number is only useful when its included modules are understood.

Troubleshoot missing or misleading coverage

  • No execution-data file: tests may not have run, or the agent may not have attached to the process. Check the task and test execution configuration; in the documented Maven setup, ensure Surefire/Failsafe forks tests rather than using forkCount=0 or forkMode=never.
  • Report is empty or stale: run the relevant tests first and verify the report consumes their execution data. In Gradle, invoking jacocoTestReport alone does not run tests.
  • Lines do not map to source: ensure compilation includes debug line information, which JaCoCo needs for source-line reporting.
  • Line coverage looks good but decisions are untested: inspect branch coverage and add cases for alternate outcomes of if and switch logic.
  • Aggregate total seems unexpected: verify that the intended subprojects and test data are included and that the report scope is consistent.
  • A threshold causes an unexpected build failure: inspect the configured verification rule and its scope, including any generated or legacy code, then decide whether the rule reflects a meaningful project requirement.

Interpret percentages without mistaking them for quality

A coverage percentage describes execution against a selected counter and code scope. It does not establish that assertions are strong or that defects would be detected. Two suites with the same line percentage can exercise different branches and behaviors; tests that execute a line but never check its result can inflate coverage without providing the protection the number may suggest. Use reports to identify unexamined behavior and make tests assert the outcomes that matter.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The documentation reviewed does not establish an industry-wide recommended threshold. Choose a project-specific target only after deciding what code counts and what failures a check should prevent. Avoid treating a percentage as a substitute for reviewing test intent.

Rank #4
2 Pack Carpenter Pencils Mechanical Pencils with 12 Refills, (2 Colors)
  • Long Nib and Deep Hole Marker: Our mechanical carpenter pencil with 45mm nib is designed for easy marking of deep holes or narrow areas. These construction pencils are the great choice for woodworking tools, construction tools, carpenter tools, contractor tools, wood carpentry tools and architect tools
  • Extra Refills in 2 Colors for Versatile Marking: The construction mechanical pencil comes with 12 extra 2.8mm refills, including 6 red and 6 black refills. The black refill is suitable for light surfaces, while the red wax is perfect for dark surfaces. Our carpenter mechanical pencil makes sure that you'll have an ample supply for extended use
  • Built-in Sharpener: Our construction pencil comes with a built-in sharpener to ensure the mechanical pencil tip is always sharp and ready for use. Never buy an extra pencil sharpener again. A great tool for any woodworker pencil, contractor pencils. The refill can easily be extended or retracted with a simple click of the pencils mechanical, allowing you to work more efficiently and accurately
  • Portable Clip Design: Our deep hole construction pencil features a portable clip design, easy to carry and attach to your pocket or tool box, so that you can keep the carpenter pencils mechanical close at hand, making it a convenient tool to have on the go. Great gifts choice for carpenters
  • Stronger Pencil Lead: The black refills are made of lead, sturdy and smooth. The red refills are made of wax, clear and light. These marking pencils are much thicker and stronger than normal pencils during the marking process of construction work, suitable for various surfaces, such as glasses, metal, boards, floors, walls, furniture, etc. The written marks can be easily wiped with a wet paper towel when needed
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

Java coverage itself is collected by JaCoCo or an IDE runner, not by a screenshot service. If you need a screenshot of a generated coverage report for a ticket, review, or documentation, ScreenshotNeo can capture its page by API; its options also include PDF output and an MCP server for AI agents. For example, save a rendered report page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-hosted-report.example -o shot.webp

See the ScreenshotNeo API documentation for request options. Before capture, cookie banners, popups, and chat widgets are removed; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I measure coverage for only selected Gradle modules?

Yes. Define the report and verification scope around the modules or source sets relevant to the question you want the metric to answer.

Best Value
Milwaukee 48-22-3104 Inkzall Point Marker, Fine, Black, 4-Pack
  • Milwaukee Ink all Fine Point Marker, Black, 4 Per Pack
  • 4 per pack Features Clog Resistant Marker Tip Writes through Dusty, Wet and Oily Surfaces Durable Marker Tip for Writing on Concrete, OSB and Rough Surfaces
  • Clog resistant tip writes on dusty, wet and oily surfaces and is optimized for rough surfaces such as OSB, cinderblock and concrete
  • Hard hat clip- attaches for easy access
  • Quick dry time with reduced smearing and marking

Does branch coverage count exceptions in JaCoCo?

No. JaCoCo’s documented branch counter covers outcomes associated with if and switch, not exception handling.

Can IntelliJ IDEA show which branches a test covered?

Yes, branch details are available with JaCoCo or with the IDEA runner when branch coverage is enabled, subject to runner and settings.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.