applying-testing-strategies

Applies Android testing strategies covering determinism, Given-When-Then structure, naming conventions, and Hilt test configuration.

1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill applying-testing-strategies-citytexi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: applying-testing-strategies
Source: https://github.com/citytexi/team-yg-pesonal-agent/tree/main/.claude/skills/applying-testing-strategies
Command: npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill applying-testing-strategies-citytexi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Android test suites often fail on CI despite passing locally, lack consistent structure, and misuse Hilt test APIs. This Skill encodes Google's official testing guidance — with accurate per-page source attribution — so tests become deterministic, consistently structured, and correctly wired with Hilt. ## Core Features & Use Cases - Determinism enforcement: Checklists and patterns for injecting Clock, dispatchers, and seeded Random, plus disabling animations via testOptions. - Structure and naming conventions: Given-When-Then / Arrange-Act-Assert comment blocks and method naming rules, including the API 30 backtick limitation for instrumented tests. - Hilt testing mechanics: Correct usage of @HiltAndroidTest, HiltAndroidRule ordering, @TestInstallIn, @UninstallModules, @BindValue, and @CustomTestApplication with WRONG vs RIGHT code patterns. - Use Case: A developer sees tests pass locally but fail on CI; the Skill diagnoses the non-determinism source (time, coroutines, animations, external state) and provides the exact fix pattern. ## Quick Start Ask the assistant to review your Android test class for determinism issues and correct Hilt rule ordering using this testing strategy skill.

Frequently Asked Questions about applying-testing-strategies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Android tests with Given-When-Then?▼

Use Given-When-Then as inline comment blocks separating setup, action, and assertion phases within each test method. Google's official samples use this comment style, though no documentation page formally prescribes it; pick one vocabulary per repository and apply it consistently.

How do I replace a Hilt binding in a single Android test?▼

Use @UninstallModules on the test class to remove the production module, then provide a replacement via an inner @Module or a @BindValue field. For replacements applying to all tests in a module, use @TestInstallIn with the replaces attribute instead.

Why do my Android tests pass locally but fail on CI?▼

The usual cause is non-determinism from wall-clock time, real dispatchers, animations, or external state like network and unseeded Random. Inject a Clock and DispatcherProvider, seed Random, set testOptions.animationsDisabled = true, and clear app state before instrumented tests.

What order should HiltAndroidRule and composeTestRule use?▼

HiltAndroidRule must execute before any rule that touches the injected graph, such as ActivityScenarioRule or composeTestRule. The conventional pattern is @get:Rule(order = 0) on HiltAndroidRule and order = 1 on the next rule, though any monotonic ordering with Hilt first works.

Can I use backtick test names in Kotlin instrumented tests?▼

Backtick test names in instrumented tests are only supported on devices running API 30 and above. Local JVM tests can use backticks freely; for instrumented tests targeting lower API levels, use camelCase or snake_case names like loadUsers_emptyList_emitsEmptyState.

When should I not use Hilt in unit tests?▼

Hilt is unnecessary for local unit tests of classes using constructor injection — instantiate the class directly with fakes. Reserve @HiltAndroidTest for UI and integration tests where Hilt generates components and injects dependencies as in production.