Use this skill to structure a Jetpack Compose UI test class the way androidx itself writes them — @MediumTest + @RunWith(AndroidJUnit4::class), a single createComposeRule(StandardTestDispatcher()) rule, hoisted mutableStateOf declared above setContent { }, and the Test → Find → Assert → Act → Re-assert flow. Covers…
Use this skill to test LazyColumn, LazyRow, and LazyVerticalGrid correctly — tag the container with Modifier.testTag(...), tag each item by its key, scroll via the semantic action (hasScrollAction(), performScrollToIndex, performScrollToKey) or via Modifier.testTag plus performTouchInput { swipeUp() }, and verify…
Use this skill to test rememberSaveable round-trips with StateRestorationTester, the only supported tool for proving Compose state survives process death and configuration change. Covers the constructor (StateRestorationTester(rule: ComposeContentTestRule)), why restorationTester.setContent { } MUST replace…
Use this skill to render every Jetpack Compose @Preview as a screenshot on a real Android device or emulator and publish a browsable HTML catalog from CI. Covers the Compose HotSwan Gradle compiler plugin (com.github.skydoves.compose.hotswan.compiler) and…
Use this skill to make @Preview functions the primary feedback loop for Jetpack Compose UI work — preview-driven development. Covers hoisting state out of composables so a preview never needs a ViewModel or DI graph, LocalInspectionMode for conditional preview rendering (e.g. placeholder instead of Coil/Glide)…
Use this skill to pick the correct Compose UI test entry point. Compares createComposeRule(), createAndroidComposeRule (), createEmptyComposeRule(), runComposeUiTest { }, and runAndroidComposeUiTest { }, plus the v1 vs v2 split (UnconfinedTestDispatcher vs StandardTestDispatcher). Encodes the rule that mixing…
Use this skill to wire the correct Gradle dependency matrix for Jetpack Compose UI tests. Covers androidTestImplementation("androidx.compose.ui:ui-test-junit4"), the debugImplementation("androidx.compose.ui:ui-test-manifest") requirement that makes createComposeRule() work, the host-test (Robolectric) trio, the…
Use this skill to choose between host (Robolectric/JVM) and device (instrumentation) tests for Jetpack Compose, and to configure each correctly. Covers the androidHostTest (a.k.a. src/test/) vs androidDeviceTest (a.k.a. src/androidTest/) source set split, what each flavor can and cannot drive (RenderThread…
Use this skill to gate CI on Jetpack Compose stability — catch when a composable becomes unskippable/unrestartable or a parameter goes stable → unstable, before it ships and tanks recomposition. Covers the Compose Stability Analyzer Gradle plugin's stabilityDump (write a .stability baseline) and stabilityCheck…
Use this skill to drive the Compose test clock by hand with MainTestClock — currentTime, autoAdvance, advanceTimeByFrame, advanceTimeBy(milliseconds, ignoreFrameDuration), and advanceTimeUntil. Explains the 16 ms frame delay used by TestMonotonicFrameClock, the per-frame ordering where withFrameNanos awaiters resume…
Use this skill to choose the right idle-synchronization primitive in Compose UI tests — waitForIdle, awaitIdle, waitUntil(conditionDescription, timeoutMillis, condition), waitUntilNodeCount, waitUntilExactlyOneExists, waitUntilAtLeastOneExists, waitUntilDoesNotExist, runOnIdle, runOnUiThread, runWhenIdle…
Use this skill to write non-flaky Compose animation tests by setting mainClock.autoAdvance = false and stepping frames by hand with advanceTimeByFrame and advanceTimeBy(durationMillis). Explains why InfiniteAnimationPolicy cancels indeterminate animations the moment the test starts unless autoAdvance is disabled, why…
Use this skill to pick which behaviors to cover in an Android test suite using Google's five-category state vocabulary plus the explicit "what NOT to test" list from /training/testing/fundamentals/what-to-test. Covers state on screen, state held in memory (ViewModels), persisted state (DB / DataStore / files), other…
Use this skill to size an Android test suite using Google's small / medium / big scope vocabulary and the qualitative pyramid. Explains why most apps should hold "many small tests and relatively few big tests", how scope (small/medium/big) is orthogonal to execution location (local vs instrumented), and where the…
Use this skill to pick the right test double — fake, mock, stub, spy, dummy, or Robolectric shadow — for an Android test. Encodes Google's verbatim preference order ("fakes ... are preferred", "Fakes are preferred over stubs for simplicity", "Fakes or mocks are therefore preferred over spies"), gives Android examples…
Use this skill to organize Android test source sets — src/test/, src/androidTest/, the community src/sharedTest/ convention, and the modern KMP-style androidHostTest / androidDeviceTest split that Compose itself adopted after AGP 7.2 broke the classic sourceSets wiring. Includes the testImplementation /…
Use this skill to write Espresso 3.7.0 tests against Android Views — onView(matcher).perform(action).check(matches(...)), onData(...) for AdapterView, RecyclerViewActions, Intents.intended/intending, and IdlingResource registration. Covers the full ViewMatchers / ViewActions / ViewAssertions catalog, the…
Use this skill to run instrumented Android tests on Gradle Managed Devices (GMD) — emulators that Gradle provisions, boots, runs tests on, and tears down, so CI and every developer get the same device without managing an emulator by hand. Covers the android.testOptions.managedDevices { localDevices { create(...) {…
Use this skill to stand up an Android instrumentation test source set with the canonical AndroidJUnit4 runner, the correct AndroidJUnitRunner Gradle wiring, and supporting infrastructure (Test Orchestrator, runtime permission grants, size annotations, SDK suppression, hermetic animation defaults). Covers…
Use this skill to launch, drive, and tear down an Activity from an instrumentation test using ActivityScenario and the JUnit4 wrapper ActivityScenarioRule. Covers ActivityScenario.launch (), launch(intent), launchActivityForResult, moveToState(Lifecycle.State.), recreate(), onActivity { }, the Closeable / use { }…
Use this skill to test a Fragment in isolation using FragmentScenario, launchFragmentInContainer (), and launchFragment (). Covers the androidx.fragment:fragment-testing + androidx.fragment:fragment-testing-manifest artifact split, the EmptyFragmentActivity host (android:Theme.WithActionBar parent — not AppCompat)…
Use this skill to drive cross-app and system-UI flows from instrumentation tests using UiAutomator 2.3.0 — UiDevice, BySelector / UiObject2 (modern), UiSelector / UiObject (legacy), Until conditions, and Configurator global timeouts. Covers the singleton acquisition…
Use this skill to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test. Covers runTest, TestScope, StandardTestDispatcher vs UnconfinedTestDispatcher, virtual time via TestCoroutineScheduler (advanceTimeBy, advanceUntilIdle, runCurrent), the canonical MainDispatcherRule wrapper…