Agent skill

Ha Android Testing

by home-assistant in home-assistant/android

Home Assistant Android testing guidance. An agent skill from home-assistant/android.

Apache-2.0Auto-check passedTesting & QA

Install Ha Android Testing

skills CLI
$ npx skills add home-assistant/android --skill ha-android-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install home-assistant/android ha-android-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/home-assistant/android.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/ha-android-testing .claude/skills/ha-android-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ha-android-testing
GitHub stars
4k
Token cost
~2k tokens
SKILL.md length
972 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Home Assistant Android testing guidance. An agent skill from home-assistant/android.

  • Reviewing unit tests
  • SKILL.md covers Frameworks, Module-Wide Test Rules, Shared Test Utilities:… and Flows: Turbine, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Robolectric tests

What it does

Ha Android Testing is an agent skill from home-assistant/android. Home Assistant Android testing guidance. Use when writing or reviewing unit tests, Robolectric tests, Flow tests with Turbine, screenshot tests, fakes from testing-unit, or module-wide test rules.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with Android and Home Assistant. The repository describes itself as: Home Assistant Companion for Android. The licence is Apache-2.0.

When your agent uses it

  • Reviewing unit tests
  • Robolectric tests
  • Flow tests with Turbine
  • Screenshot tests

Example prompts

  • “/ha-android-testing”

What it can do on your machine

Read from SKILL.md and the folder at commit eaa2122. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Ha Android Testing loads about 2k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 972 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from home-assistant/android at commit eaa2122, republished under its Apache-2.0 licence (© home-assistant). 972 words, ~2,002 tokens.

Download SKILL.mdSave it as .claude/skills/ha-android-testing/SKILL.md (or your agent's skills folder).
name
ha-android-testing
description
Home Assistant Android testing guidance. Use when writing or reviewing unit tests, Robolectric tests, Flow tests with Turbine, screenshot tests, fakes from testing-unit, or module-wide test rules.

HA Android Testing

Use this skill when writing, changing, or reviewing tests.

bash
./gradlew test                          # Unit tests (:common:test for one module)
./gradlew validateDebugScreenshotTest   # Screenshot tests

After an intentional UI change, update the reference screenshots (stored under src/screenshotTestFullDebug/reference in :app, src/screenshotTestDebug/reference in :common and :wear) with ./gradlew updateDebugScreenshotTest updateFullDebugScreenshotTest. Rendering differs subtly between hosts, so if CI still fails on thresholds, a maintainer triggers the Update Screenshots workflow to regenerate them on the CI host — don't chase pixel diffs locally.

Don't run a validate task after an update run: the update will update the screenshots from the code you just built, so validation can only confirm that or resurface the subtle host differences in rendering. Check that the images were updated and have changed instead, that is what tells you the change is right. Validate only when you have not regenerated, to find out if a change unintentionally changed the UI.

Known false positive

ServerDiscoveryScreenshotTest could fails validation because of host rendering differences. CI is the source of truth, so treat its failure as expected output, not a result:

  • Never report it — not as a finding, a regression, a pre-existing failure, or a caveat next to other results. It is noise, so say nothing about it.
  • Never investigate it, and never regenerate or commit its reference images; after an update run, revert them unless that screen is what you intentionally changed.
  • A screenshot run whose only failure is this test counts as passing.

Frameworks

  • JUnit Jupiter for unit tests; JUnit 4 only when Robolectric requires it.
  • MockK for mocking — but prefer real objects or fakes when you can.
  • Robolectric for Android APIs; prefer it over instrumentation tests. Instrumentation tests are a last resort or for verifying system behavior across API levels.
  • Every Robolectric test class needs both annotations, otherwise Robolectric boots the real HomeAssistantApplication, enabling StrictMode and FailFast and leaking process-wide state that can crash the test JVM:
kotlin
@RunWith(RobolectricTestRunner::class)
@Config(application = HiltTestApplication::class)
class MyTest { ... }

Module-Wide Test Rules

Rules that must apply to every test in a module are JUnit Platform TestExecutionListeners registered through ServiceLoader (src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener). They run for both JUnit 4 (Vintage) and Jupiter tests — use this mechanism instead of per-class setup when introducing a new cross-cutting rule:

  • TestStateResetPlatformListener (per test module) resets process-wide singletons before every test: it installs a FailFast handler that rethrows as AssertionError, so any FailFast trigger surfaces as a test failure instead of crashing the JVM, and resets SdkVersion.
  • ConsoleLogPlatformListener (from :testing-unit) plants a Timber tree that prints to stderr so logs are visible during tests.

Robolectric runs tests in a sandbox class loader with its own copy of every app class, so a JUnit Platform listener never reaches the singletons a Robolectric test sees. A reset that must also apply to Robolectric tests needs a TestEnvironmentLifecyclePlugin too, registered in src/test/resources/META-INF/services/org.robolectric.pluginapi.TestEnvironmentLifecyclePlugin: Robolectric loads it inside the sandbox and calls it before every test. TestStateResetRobolectricPlugin does this for the FailFast and SdkVersion reset, and ConsoleLogRobolectricPlugin (from :testing-unit) plants the Timber console tree.

Show full SKILL.md (496 more words)Show less

Shared Test Utilities: :testing-unit

Code needed by tests in several modules goes in :testing-unit (which must stay independent from :common). Check it before writing a new helper. It provides among others:

  • Main dispatcher swap — replaces Dispatchers.Main with a TestDispatcher. Pick the helper matching the test's framework: MainDispatcherJUnit5Extension for JUnit Jupiter, applied with @ExtendWith(MainDispatcherJUnit5Extension::class) on the class (or @JvmField @RegisterExtension val ext = MainDispatcherJUnit5Extension() on a field); MainDispatcherJUnit4Rule for JUnit 4 / Robolectric, applied with @get:Rule val mainDispatcherRule = MainDispatcherJUnit4Rule(). Both default to a StandardTestDispatcher. Apply the swap only when the code under test actually runs on the Main dispatcher, typically because it launches on viewModelScope (which uses Dispatchers.Main.immediate). Without it those tests throw "Module with the Main dispatcher had failed to initialize" since there is no Android main looper on the JVM. Don't add it to tests that never touch Main (a plain repository, use case, or pure suspend function) — it's noise there. Use the default StandardTestDispatcher; do not use UnconfinedTestDispatcher. Reaching for it to make a test pass hides ordering the test should assert explicitly (advance the scheduler with runTest/advanceUntilIdle), and needing it usually signals a design problem in the code under test — fix that instead.
  • FakeClock — controllable kotlin.time.Clock.
  • TestSharedFlow — non-suspending SharedFlow test double that avoids cross-scheduler deadlocks.
  • stringResource(...) on AndroidComposeTestRule, seedFakeAndroidId(), and fakes for Wear OS clients.

Flows: Turbine

Turbine is available in all modules and must be used for testing Flows:

  • Use turbineScope with testIn for multi-collector tests; assert with awaitItem/awaitComplete/expectNoEvents.
  • Never synchronize on Flow emissions with CountDownLatch, Thread.sleep, verify(timeout = ...), or raw launch/async.
  • Flows wrapped with shareIn never complete — use expectNoEvents() + cancelAndConsumeRemainingEvents() instead of awaitComplete().

Conventions

  • Tests mirror the source structure in src/test/kotlin/.
  • Name tests with GIVEN-WHEN-THEN sentences:
kotlin
@Test
fun `Given user authenticated when opening app then show dashboard`() { ... }
  • Test public interfaces and behavior, not implementation details. All public APIs and business logic should have unit tests.
  • Never widen visibility or use reflection just for a test: don't expose internal functions to test them — test through the public entry point (onCreate, the ViewModel API). When access is truly unavoidable, use @VisibleForTesting (for example a secondary constructor taking a CoroutineScope or Clock).
  • Never use Thread.sleep in tests — it makes them slow and flaky. Run coroutines under runTest so the TestDispatcher fakes time.
  • In Jupiter, use @ParameterizedTest when tests repeat with only a value change; in JUnit 4, extract a private function and call it from separately named tests. Merge near-duplicate single-assertion tests into one meaningful test, and add a small helper in the test file for repeated setup.
  • Keep all of a feature's tests in one class, even when mixing Robolectric-dependent and plain unit tests.
  • Screens are tested in isolation: Compose interaction tests verify each interaction invokes the right callback and that elements show/hide per state (see TagReaderScreenTest); prefer matching on visible text over test tags. Screenshot tests cover looks only, never logic — and must render the real composable (not a simplified stand-in) across its meaningful states (loading, empty, error, multi-server). Navigation tests must cover back and forward stack behavior.
  • Test concurrency with TestDispatcher — see the ha-android-concurrency skill.

© home-assistant, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/ha-android-testing of home-assistant/android.

Open the folder on GitHubat commit eaa2122

Compare with similar skills

Ha Android Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Ha Android Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ha Android Testing this skillhome-assistant/android4k—~2kAutomated safety check: PassApache-2.0
Testing SkillTypeCellOS/BlockNote10k—~2.6kAutomated safety check: PassCustom licence
Mesh Labpermissionlesstech/bitchat-android7.8k—~2.9kAutomated safety check: PassGPL-3.0
Ha Frontend Testinghome-assistant/frontend5.7k—~1.7kAutomated safety check: PassApache-2.0
Add Library Testosama-raddad/FireCrasher147—~612Automated safety check: PassApache-2.0
Ha Integration TestingFutureTense/keymaster349—~522Automated safety check: PassMIT

Similar skills

  • Testing Skill

    TypeCellOS/BlockNote

    Instructions for writing, running, and updating unit/end-to-end tests.

    10k GitHub stars~2.6k tokensUpdated today
    Testing & QAAuto-check passed
  • Mesh Lab

    permissionlesstech/bitchat-android

    Run, diagnose, and extend bitchat Android Mesh Lab physical-device tests.

    7.8k GitHub stars~2.9k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Ha Frontend Testing

    home-assistant/frontend

    Home Assistant frontend testing and validation workflow. An agent skill from home-assistant/frontend.

    5.7k GitHub stars~1.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Add Library Test

    osama-raddad/FireCrasher

    Add or update a Robolectric JVM unit test for the FireCrasher library.

    147 GitHub stars~612 tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Ha Integration Testing

    FutureTense/keymaster

    Workflows, conventions, and commands for writing and running async Home Assistant unit and integration tests using pytest, tox, pytest-homeassistant-custom-component, and coverage tools.

    349 GitHub stars~522 tokensUpdated today
    Testing & QAAuto-check passed
  • Dependency Pins

    cognitivegears/ha-escpos-thermal-printer

    A skill your agent uses when bumping any dependency, upgrading the HA test harness (pytest-homeassistant-custom-component) or HA floor, or handling Dependabot PRs/security alerts — per-package pin…

    112 GitHub stars~1.1k tokensUpdated 2 days ago
    Testing & QAAuto-check passed

More from home-assistant/android

All 10 skills in this repo
  • Ha Android Architecture

    home-assistant/android

    Home Assistant Android module and layer architecture. An agent skill from home-assistant/android.

    4k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Ha Android Concurrency

    home-assistant/android

    Home Assistant Android coroutine and threading guidance. An agent skill from home-assistant/android.

    4k GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Ha Android E2E Debugging

    home-assistant/android

    Home Assistant Android end-to-end (Maestro) failure triage. An agent skill from home-assistant/android.

    4k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Ha Android Kotlin Style

    home-assistant/android

    Home Assistant Android Kotlin style. An agent skill from home-assistant/android.

    4k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Ha Android Logging Errors

    home-assistant/android

    Home Assistant Android logging and error handling. An agent skill from home-assistant/android.

    4k GitHub stars~845 tokensUpdated today
    Auto-check passed
  • Ha Android UI

    home-assistant/android

    Home Assistant Android UI guidance. An agent skill from home-assistant/android.

    4k GitHub stars~1.5k tokensUpdated today
    Auto-check passed

Categories

Questions about Ha Android Testing

What does Ha Android Testing do?

Home Assistant Android testing guidance. An agent skill from home-assistant/android. Ha Android Testing is an agent skill from home-assistant/android. Home Assistant Android testing guidance.

When should I use Ha Android Testing?

Ha Android Testing fits situations like: reviewing unit tests; robolectric tests; flow tests with Turbine; screenshot tests.

How do I install Ha Android Testing in Claude Code?

Run `npx skills add home-assistant/android --skill ha-android-testing -a claude-code`. Or copy the skill folder (.agents/skills/ha-android-testing in home-assistant/android) into .claude/skills/ha-android-testing in your project. Claude Code loads it when a task matches its description.

How do I install Ha Android Testing in Codex?

Run `npx skills add home-assistant/android --skill ha-android-testing -a codex`. Or copy the skill folder (.agents/skills/ha-android-testing in home-assistant/android) into .agents/skills/ha-android-testing in your project. Codex loads it when a task matches its description.

Can I use Ha Android Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add home-assistant/android --skill ha-android-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ha-android-testing, .gemini/skills/ha-android-testing, .github/skills/ha-android-testing and .opencode/skills/ha-android-testing in your project.

What does Ha Android Testing need to run?

SKILL.md names no scripts, command-line tools or credentials: Ha Android Testing is instructions for the agent only.

Does Ha Android Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Ha Android Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ha Android Testing use?

Ha Android Testing is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ha Android Testing use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ha Android Testing?

Skills that share tags, products or a category with Ha Android Testing: Testing Skill (TypeCellOS/BlockNote, 10k stars), Mesh Lab (permissionlesstech/bitchat-android, 7.8k stars), Ha Frontend Testing (home-assistant/frontend, 5.7k stars) and Add Library Test (osama-raddad/FireCrasher, 147 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ha Android Testing?

home-assistant (a GitHub organization) maintains it in home-assistant/android, which has 3,954 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

Source: home-assistant/android on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.