What Is a Good Test for Partial Data Coverage?
From the earlier reference collection. Read the current software blog.
Place data gaps at the beginning, middle, and end of a series and verify that coverage reporting identifies each accurately.
Represent the expected interval
Choose a requested interval and define the observations expected within it. Then create a fixture with missing coverage at the start, a gap in the middle, and missing coverage at the end. These positions reveal different mistakes: clipping the requested range, assuming a gap can only occur internally, or treating the final observation as proof of complete coverage.
Use a small timeline whose expected missing segments can be calculated by inspection. For example, request ten hourly slots, provide the second through fourth and seventh through ninth, and leave the first, fifth, sixth, and tenth absent. The expected covered and uncovered ranges should be explicit in the test.
Assert the report’s meaning
Check that the product distinguishes no observations from partial coverage and complete coverage. A percentage alone can conceal where the gaps occur; if the interface promises ranges or a last-updated time, assert those details too. Confirm that counts use the same denominator as the displayed requested interval.
Test boundary inclusivity carefully. If the interval ends at 10:00, decide whether that endpoint is an included sample or an exclusive boundary, and build the fixture around that documented convention. Ambiguity here can create off-by-one coverage reports that appear plausible.
Vary gap shape and frequency
Include adjacent missing slots as well as separated gaps. A reporting function may merge neighboring missing intervals, and the test should confirm the chosen behavior. If samples arrive at irregular intervals, test the rule that determines expected slots instead of assuming a fixed cadence.
For sensor or public-data dashboards, missingness can matter as much as the observed value. Ensure that a zero reading is not treated as absent and that a missing row is not silently filled with zero unless interpolation or imputation is explicitly part of the product.
Verify the user-facing path
Check that the coverage summary uses clear units and dates and remains consistent with the chart or table. A chart with blank spans and a status label saying “complete” is a meaningful integration failure even if the coverage helper computes the right value.
This test is strongest when it captures the exact fixture, requested interval, expected gaps, and displayed report. It ensures that the system describes partial evidence honestly and lets readers see both how much data exists and where it is missing.