Android Generate All Tests

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Bring one Gradle module’s JVM unit test coverage up to a minimum bar — 80% line coverage — in one pass: find every class with no test class at all, or with measured coverage below the bar, then write or extend tests for each until it clears it. Kotlin/Android/Gradle only; it never runs against, or falls back to, any other language or build tool.

Purpose

iru-android-generate-all-tests answers "bring this whole module’s test coverage up to a bar" rather than "write tests for this one class/task," which is what iru-android-code-one-task and the iru-code pipeline already handle per task. It uses the Explore agent to build an inventory of testable classes and the module’s existing test convention, delegates to iru-android-coverage for the exact, measured percentage per class (never an estimate), and only writes or extends JVM unit test code under src/test/java — it does not add license headers, KDoc, or run a code-quality pass, and it only touches production source code when a class is genuinely untestable as written (e.g. no seam to substitute a hard dependency), which it reports explicitly rather than silently redesigning the class. For a module that renders UI it also adds a UI-test step (Step 5b, per the UI contract in Building user interfaces): Robolectric + Roborazzi tests for every existing screen and component that has none, capturing each visual state × the .ui-quality.yml directions × themes into .ui-screenshots/ through the module’s testing/UiScreenshots.kt helper and running the Accessibility Test Framework at the configured level. It follows this catalog’s JUnit 4 + MockK + Robolectric conventions, grounded in the real Android reference repository, when a project has nothing of its own to learn from.

Kotlin Multiplatform projects are out of scope: when the Kotlin Multiplatform plugin is applied anywhere in the build (a KMP app’s Android host module included), the skill stops and hands the request to KMP Generate All Tests instead.

Plugin

Shipped by the iru-android plugin of the ai-catalog marketplace (install with /plugin install iru-android@ai-catalog; see Plugins).

Invocation

/iru-android-generate-all-tests [scope]

Inputs

Argument Required Description Default

scope

No

The Gradle module to scope this run to, or a comma-separated list of specific classes (their module is resolved from each one’s file path).

lib (or asked via AskUserQuestion if no lib module exists and more than one module applies an Android plugin)

Outputs

  • New or extended JVM unit test files under <module>/src/test/java for every class found with no matching test class, or with line coverage below 80% — following this project’s own JUnit 4/JUnit 5, MockK, and Robolectric conventions, including the SDK-branch test-class split convention where the project already uses it.

  • Occasionally, a minimal testability change to a class under test (e.g. extracting an interface, injecting a dependency) — only when a class is genuinely untestable as written, and always called out explicitly rather than folded silently into "tests added."

  • A report: total candidate classes found (and any excluded as having no testable logic), how many already met the bar, before/after coverage per class touched, any class still below 80% after two extension attempts (with its exact remaining uncovered lines and, where apparent, why), and the full-suite test result.

  • For a UI module: Robolectric UI tests for every screen/component without one, the testing/UiScreenshots.kt helper (created when absent), the screenshot count per kind with any malformed names, the accessibility results and level applied (none is reported "accessibility: opted out", off "accessibility checks off"), and any test-scope dependency or testOptions change made to the module’s build.

  • No src/androidTest instrumented tests, license headers, KDoc, or code-quality fixes — those remain opt-in, or iru-check-license, iru-android-dokka, and `iru-android-code-quality’s jobs respectively (the JVM UI tests are not instrumented tests and are generated by default).

Execution flow

flowchart TD A[Start /iru-android-generate-all-tests] --> B{"Kotlin/Android Gradle\nproject found?"} A -. "KMP plugin applied" .-> KMP["Stop: hand off to iru-kmp-generate-all-tests"] B -- no --> B1[Stop: Kotlin/Android\nGradle only] B -- yes --> C{"Multiple Android modules\n&amp; no scope given?"} C -- yes, no lib module --> C1["AskUserQuestion:\nwhich module?"] C -- yes, lib exists / single module / scope given --> D C1 --> D["Explore agent: inventory every\nmain-source class + existing test\nconvention + test source root"] D --> E["gate-runner: single android-coverage run\nover every candidate class\n(batched if the list is large)"] E --> F["Classify: missing tests /\nbelow 80% / already sufficient"] F --> G["One agent per class (parallel batches):\nwrite new or extend existing tests"] G --> G2["UI modules: Step 5b agents write\nRobolectric UI tests (states x direction\nx theme captures + accessibility)"] G2 --> H["Re-measure via android-coverage,\nscoped to touched classes"] H --> I{"Still below 80%?"} I -- yes, attempts left --> G I -- yes, 2 attempts used --> J[Report as residual gap\nwith exact uncovered lines] I -- no --> K["gate-runner: run full unit-test\nsuite once (android-test);\nUI modules: android-test ui: jvm"] J --> K K --> L{"Any failures?"} L -- yes, caused by this run --> M[Fix regression; re-run full suite] M --> K L -- no / pre-existing --> N[Final report]

Dependencies

Invokes

  • Android Coverage — Step 3, and again in Step 6 to re-measure after generation: delegated through the iru-gate-runner agent so its per-class JaCoCo XML/HTML report never lands directly in this conversation, and so the whole suite runs once per batch rather than once per class.

  • Android Test — Step 7, once, to confirm the full JVM unit-test suite still passes after every class’s tests have been written or extended; also delegated through iru-gate-runner. For a UI module it is run once more with ui: jvm (Step 5b) to collect screenshot counts, malformed names and accessibility results.

It stops and redirects Kotlin Multiplatform projects to KMP Generate All Tests (a hand-off, not an invocation).

Invoked by

None from inside this catalog — it is a top-level entry point invoked by a person who wants coverage brought up across one Gradle module in one pass, independent of the /iru-code//iru-issue pipeline (which handles per-task test-writing via iru-android-code-one-task).

  • Explore — Step 2, to build the class/test-file inventory across the module without reading every source file directly.

  • iru-gate-runner — Steps 3, 6, and 7, to run iru-android-coverage/ iru-android-test and report back only a compact summary instead of a raw coverage/test log.

  • general-purpose (default, no subagent_type named) — Step 5, one per class needing new/extended tests (and, in Step 5b, one per screen/component needing UI tests), dispatched concurrently since each only touches its own test file.

Source

SKILL.md on GitHub — the file this page was generated from.