add-missing-unit-test

Adds unit tests for untested classes and verifies coverage improvement with Kover.

2.0k|355|Updated Jul 25, 2016
One-click install
npx skills add https://github.com/flutter/flutter-intellij --skill add-missing-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-missing-unit-test
Source: https://github.com/flutter/flutter-intellij/tree/main/.agents/skills/add-missing-unit-test
Command: npx skills add https://github.com/flutter/flutter-intellij --skill add-missing-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Classes in the flutter-intellij plugin codebase often lack unit tests or have incomplete coverage, making regressions hard to catch. This Skill guides the AI through a disciplined workflow to add tests and prove coverage gains.

Core Features & Use Cases

  • Baseline Establishment: Compiles sources with ./gradlew testClasses, runs ./gradlew verifyPlugin, and measures current coverage via Kover reports before writing any test.
  • Test Implementation: Creates a new [ClassName]Test in testSrc/ or extends an existing test file, following project conventions for naming, mocking, and assertions.
  • Verified Coverage Improvement: Re-runs Kover (koverHtmlReport/koverXmlReport) after implementation and produces a commit message that explicitly states the coverage delta.
  • Use Case: You notice a utility class in src/ with complex branching logic but no tests. The Skill writes the test, confirms it passes, and reports that line coverage rose from 0% to 78%.

Quick Start

Add unit tests for the class I specify and verify the coverage improvement with Kover.

Frequently Asked Questions about add-missing-unit-test

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

FAQPage Schema
How do I add unit tests to an IntelliJ plugin project?

Create a test class named [ClassName]Test in the testSrc directory, following the project's naming, mocking, and assertion conventions. Compile with ./gradlew testClasses and run the new test to confirm it passes before measuring coverage.

How to measure code coverage with Kover in Gradle?

Run ./gradlew koverHtmlReport or ./gradlew koverXmlReport to generate coverage reports for the project. Compare the target class's line coverage before and after adding tests to quantify the improvement.

Does this workflow verify the IntelliJ plugin still works?

Yes, the workflow runs ./gradlew verifyPlugin both before and after adding tests to ensure no plugin verification regressions. It also compiles all sources with testClasses to catch build errors early.

What should the commit message include for new unit tests?

The commit message should explicitly state the Kover coverage improvement, following the pattern: Add unit tests for [Class Name] with the line coverage percentage, covered count, and uncovered count. The Skill does not commit or push automatically.

When should I add tests to an existing test file instead of creating a new one?

Add test cases to an existing test file when the target class already has a corresponding [ClassName]Test in testSrc. Create a new test class only when no test file exists for the class being covered.