kmp-coverage-grower

Incrementally grow unit-test coverage on Kotlin Multiplatform projects using Kover reports and commonTest.

Updated Jan 2, 2024
One-click install
npx skills add https://github.com/Mithrandir21/game-deals-app --skill kmp-coverage-grower-mithrandir21
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-coverage-grower
Source: https://github.com/Mithrandir21/game-deals-app/tree/main/.claude/skills/kmp-coverage-grower
Command: npx skills add https://github.com/Mithrandir21/game-deals-app --skill kmp-coverage-grower-mithrandir21

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kotlin Multiplatform projects often have low or unknown unit-test coverage, and teams don't know which files to test first or how to write tests that run on both Android and iOS. This Skill provides a structured workflow to measure coverage, pick high-value targets, and add edge-case tests that stick. ## Core Features & Use Cases - Coverage Measurement Setup: Configures Kover (or JaCoCo for Android-only) with sensible exclusion filters and HTML report generation. - Target Prioritization: Ranks files by value — repositories, use cases, ViewModels, parsers — instead of chasing an overall percentage. - commonTest-First Strategy: Places tests in commonTest so one test runs on both Android and iOS, with guidance on when platform source sets are required. - Edge-Case Checklists: Systematic lists for inputs, state, errors, cancellation, Flows (Turbine), and platform quirks. - Coverage Ratchet: Sets a Kover verify floor in CI so coverage only goes up over time. - Use Case: A team with a KMP shared module and zero tests asks to "improve coverage" — the Skill inventories the codebase, sets up Kover, picks the lowest-covered repository, and adds focused tests with a CI floor. ## Quick Start Ask the assistant to analyze this Kotlin Multiplatform project's test coverage and add unit tests for the highest-priority uncovered files.

Frequently Asked Questions about kmp-coverage-grower

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add unit tests to a Kotlin Multiplatform project?▼

Place tests in the commonTest source set using kotlin.test so they run on both Android and iOS. Use runTest with StandardTestDispatcher for coroutines, Turbine for Flow assertions, and hand-written fakes instead of mocking libraries for collaborators.

Kover vs JaCoCo for Kotlin Multiplatform coverage?▼

Kover is the recommended choice for KMP because it aggregates coverage across platforms and handles commonMain source-set coverage correctly, which JaCoCo does not. JaCoCo remains acceptable for Android-only projects.

How do I set up a Kover coverage report in Gradle?▼

Apply the org.jetbrains.kotlinx.kover plugin in each module, configure report filters to exclude DI and generated classes, then run ./gradlew :shared:koverHtmlReport. The HTML report is generated under build/reports/kover/html/index.html.

Should I use MockK or fakes for KMP unit tests?▼

Prefer hand-written fakes implementing your interfaces. MockK has KMP support but adds friction, while fakes work on every platform, keep tests readable, and avoid coupling tests to implementation details.

Why did my coverage not increase after adding tests?▼

Verify the tests actually run on both platforms with ./gradlew :shared:allTests, check that Kover filters are not excluding the target branches, and confirm assertions are strict enough to exercise the intended code paths.

How do I prevent code coverage from dropping in CI?▼

Add a Kover verify rule with a minBound set near the current coverage and run ./gradlew :shared:koverVerify in CI. Raise the bound by 5-10 points on every coverage-improving pull request to ratchet coverage upward.