setting-up-host-vs-device-tests
CommunityChoose the right Compose test source set
Software Engineering#jetpack compose#screenshot tests#androidTest#robolectric#instrumentation tests#androidHostTest#render thread
Authorskydoves
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It helps you decide whether a Jetpack Compose test should run on the host (Robolectric/JVM) or on a real/virtual device (instrumentation), and then configure it so key capabilities actually work.
Core Features & Use Cases
- Host vs device selection: Use
src/test/(host) for fast logic/recomposition/finder-style assertions, andsrc/androidTest/(device) for RenderThread-dependent behavior. - Correct source-set placement: Organize tests so screenshot capture, ripple/
Modifier.indicationrendering, and accessibility checks run in the right flavor. - Robolectric host skeleton & guardrails: Apply the canonical
@RunWith(AndroidJUnit4::class)and@Config(minSdk = 23)setup and enforce clock-driven determinism. - Legitimate
Thread.sleeponly for RenderThread: ReplaceThread.sleepin host tests entirely, and allow it in device tests only as a RenderThread waiting mechanism for screenshot/golden assertions.
Quick Start
Tell the AI: “I have a Jetpack Compose test that passes locally but fails on CI—should it go in src/test or src/androidTest, and what setup do I need?”
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: setting-up-host-vs-device-tests Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#setting-up-host-vs-device-tests Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.