/android-testing:android-testingfrom android-testing
Writes and fixes Android tests where the test setup already exists. Use for "No compose hierarchies found", "Method d in android.util.Log not mocked", a Compose UI test that sleeps or flakes, onNodeWithText not finding a node, Hilt test rules, Robolectric versus instrumented tests, and connectedDebugAndroidTest failures. Covers createComposeRule, waitUntil, idling, useUnmergedTree, Gradle Managed Devices and Orchestrator.
Ships in android-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Write and fix tests that need Android, in a project whose test setup exists. Read app/build.gradle(.kts) and any existing tests first: JUnit 4 versus Jupiter, Truth or AssertJ, Robolectric present or not, the testInstrumentationRunner, and whether Hilt is in use. Match what is there.
Not for:
android-skills:testing-setup);runTest and Turbine (kotlin-testing);unit-testing);android-device);e2e-testing);jetpack-compose).Thread.sleep, retries or a longer timeout alone.| The test needs | Run as |
|---|---|
Pure logic, no android.* | local JVM test in src/test (see kotlin-testing) |
Context, resources, Looper, Log, SharedPreferences, a Room in-memory database, a Compose UI test, no hardware | Robolectric in src/test |
| Real device behavior: permissions dialogs, WebView, camera, real rendering, OEM quirks, Espresso against the real activity | instrumented test in src/androidTest |
Prefer the cheapest runtime that shows the behavior. Moving a test from instrumented to Robolectric is a speed win; moving a test with device-specific behavior the other way is a correctness fix.
RuntimeException: Method d in android.util.Log not mocked means a local test touched the stub android.jar. Fix in this order:
testOptions { unitTests.isReturnDefaultValues = true } only as a last resort: every Android call then returns null, 0 or false and can hide real bugs.Details and a Robolectric setup: references/robolectric.md.
setContent and assert a semantic result or a callback; avoid the full app graph.waitForIdle, runOnIdle or a bounded waitUntil { ... } on a real condition. Never sleep.onNodeWithText merges semantics; add useUnmergedTree = true to reach a child inside a merged button or card.Patterns, interaction state, idling and diagnosis: references/compose-ui.md.
@HiltAndroidTest, HiltAndroidRule ordered first, a custom runner that returns HiltTestApplication, @TestInstallIn to replace modules. Setup, Robolectric variant and the Compose activity: references/hilt.md.
Espresso is for View-based screens; onView(withId(...)).perform(click()).check(matches(isEnabled())). In a mixed screen use createAndroidComposeRule and Espresso in the same test; Compose and Espresso synchronize with each other. Match views by id or content description, not by displayed text.
./gradlew :app:testDebugUnitTest --tests 'com.example.FooTest.bar'
./gradlew :app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.FooTest#bar
Always name the module and variant. connected* runs on every attached device; set ANDROID_SERIAL to pick one. Gradle Managed Devices, Orchestrator, sharding and "No tests found": references/running.md.
pm clear, adb uninstall or wipe an emulator without asking.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub adminhead/claude-plugins --plugin android-testingOther plugins' skills for the same job