setting-up-host-vs-device-tests

Community

Choose the right Compose test source set

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, and src/androidTest/ (device) for RenderThread-dependent behavior.
  • Correct source-set placement: Organize tests so screenshot capture, ripple/Modifier.indication rendering, 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.sleep only for RenderThread: Replace Thread.sleep in 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 required

Components

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.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.