setting-up-host-vs-device-tests

setting-up-host-vs-device-tests is a skill for Claude Code, Codex from skydoves/android-testing-skills. It costs 185 tokens per session (4,609 once invoked), scanned A, original, Apache-2.0.

A guide to choosing between host tests that run on the JVM and device tests that run on an Android device or emulator for Jetpack Compose. It explains how the two environments differ and how to configure each source set.

In plain words
What is it for?
Use it when deciding between `src/test/` and `src/androidTest/`, configuring Compose tests, investigating Robolectric differences, or testing rendering and animations.
Why use it?
It helps prevent tests from failing because they require Android rendering, accessibility, timing, or other device behavior unavailable in a JVM test. It also addresses flaky waits and runner-specific problems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is @get:Rule val rule = createComposeRule() // or v2 import — see ./choosing-test-rule-vs-runtest/.

Good fit Use it when deciding between src/test/ and src/androidTest/, configuring Compose tests, investigating Robolectric differences, or testing rendering and animations.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/skydoves/android-testing-skills
agentmods
npx agentmods add skills/skydoves/android-testing-skills/setting-up-host-vs-device-tests

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for setting-up-host-vs-device-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/skydoves/android-testing-skills/setting-up-host-vs-device-tests.svg)](https://agentmods.dev/skills/skydoves/android-testing-skills/setting-up-host-vs-device-tests)
Your own site
<a href="https://agentmods.dev/skills/skydoves/android-testing-skills/setting-up-host-vs-device-tests"><img src="https://agentmods.dev/badge/skills/skydoves/android-testing-skills/setting-up-host-vs-device-tests.svg" alt="Measured on agentmods" height="20"></a>
Per session 185 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,609 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00185 $0.04609
Opus 5 $0.00093 $0.02305
Sonnet 5 $0.00037 $0.00922
Haiku 4.5 $0.00018 $0.00461

Measured 7d ago against content hash 3c4cbe015687, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

setting-up-host-vs-device-tests scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

compose/setup/setting-up-host-vs-device-tests/SKILL.md · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Setting Up Host vs Device Tests — Pick the Right Source Set

Compose tests run unchanged on either Robolectric (JVM, fast, no emulator) or on a real/virtual device (full Android stack, RenderThread, accessibility). The same runComposeUiTest { setContent { … } } block compiles in both — only the underlying Looper and Choreographer differ. This skill encodes which flavor each test should live in, the Robolectric class skeleton, and the one legitimate Thread.sleep exception (screenshot tests waiting on the RenderThread).

When to use this skill

  • The user is starting a Compose UI test and asks "test/ or androidTest/?".
  • A test passes on a local emulator but fails on CI's Robolectric runner (or vice versa).
  • The user reports Build.FINGERPRINT == "robolectric" warnings from enableAccessibilityChecks(...).
  • A screenshot test produces a black/empty PNG on the host runner.
  • A ripple/pressInteraction test renders no ripple on Robolectric and the user is debugging why.
  • The user wrote Thread.sleep(1000) to "wait for an animation" and is asking why it is flaky.
  • The user mentions androidDeviceTest / androidHostTest source sets (used in androidx itself).

When NOT to use this skill

  • The dependencies are not yet wired correctly — start with ./configuring-test-dependencies/SKILL.md.
  • The choice is between createComposeRule() and runComposeUiTest { } — see ./choosing-test-rule-vs-runtest/SKILL.md.
  • The test runs in the right flavor but is flaky on idle/animation — see ../../synchronization/synchronizing-with-idle/SKILL.md and ../../synchronization/testing-animations-deterministically/SKILL.md.

Prerequisites

  • androidx.compose.ui:ui-test, ui-test-junit4, and ui-test-manifest on the correct configurations for the chosen flavor — see ./configuring-test-dependencies/SKILL.md.
  • For host tests: org.robolectric:robolectric on testImplementation, testOptions { unitTests.isIncludeAndroidResources = true } in the Android block.
  • For device tests: a configured emulator or physical device, androidx.test.runner.AndroidJUnitRunner (or a Hilt subclass) as the testInstrumentationRunner.
  • Working knowledge of MainTestClock semantics — see the synchronization skill set.

Read the full file on GitHub · 304 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 304 lines · 185 tokens per session scan A 3c4cbe015687

Subscribe to this mod's changes

setting-up-host-vs-device-tests is a skill published in the GitHub repository skydoves/android-testing-skills (318 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 185 tokens to every session and 4,609 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

mobiai-android-testing

Use when writing or running tests in an Android project — unit tests, UI tests, choosing the right framework and patterns.

ArisGuimera/MobiAI-Core · 30 tokens

flutter-testing-skill

Generates Flutter widget tests, integration tests, and golden tests in Dart. Supports local execution and TestMu AI cloud for real device testing. Use when user mentions "Flutter", "widget test", "WidgetTester", "testWidgets", "fluttertest", "integrationtest". Triggers on: "Flutter", "widget test", "Dart test"…

LambdaTest/agent-skills · 89 tokens

rn-testing

Testing React Native: Jest with jest-expo / react-native preset, React Testing Library Native, native module mocking, hook testing. Optional sections for Detox (native automation) and Maestro (declarative YAML e2e). Use this skill to: Configure Jest preset based on workflow. Write component tests with…

AratKruglik/claude-sdlc · 163 tokens

testing-reactnative

Testing React Native 0.85+. Use when writing tests, reviewing test coverage, or setting up testing.

TheBeardedBearSAS/claude-craft · 26 tokens

ios-testing

Testing patterns for Swift and SwiftUI apps.

TalissonVitorino/kmp-ios-skills · 69 tokens

flutter-tester

Use when creating, writing, fixing, or reviewing tests in a Flutter project. Covers unit tests, widget tests, integration tests, Riverpod provider testing, and Mockito mocking. Provides Given-When-Then patterns, layer isolation strategies, and test setup for GetIt, SharedPreferences, and FakeDatabase.

Harishwarrior/flutter-claude-skills · 65 tokens