applying-testing-strategies

Apply Android testing strategies for deterministic, structured Hilt test suites.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill applying-testing-strategies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: applying-testing-strategies
Source: https://github.com/skydoves/android-testing-skills/tree/main/fundamentals/strategies/applying-testing-strategies
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill applying-testing-strategies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you structure Android test suites so they scale reliably, stay readable, and avoid common CI-only failures caused by flakiness, time, concurrency, or external state.

Core Features & Use Cases

  • Test structure & naming: Establishes a consistent Given-When-Then flow and a readable test method naming convention for faster debugging.
  • Determinism & hermeticity guidance: Provides a checklist for eliminating sources of non-determinism like time, coroutines, animation timing, randomness, and external dependencies.
  • Hilt-based dependency replacement: Explains how to correctly use @HiltAndroidTest, HiltAndroidRule, and the module replacement APIs (@TestInstallIn, @UninstallModules, @BindValue), including rule ordering and inject() requirements.
  • Source-of-truth mapping: Clarifies which guidance belongs to strategies vs stability vs Hilt testing so you don’t misattribute recommendations.

Quick Start

Use the applying-testing-strategies skill to rewrite your Android test class to follow Given-When-Then, remove flake sources, and correctly apply Hilt replacement with deterministic rule ordering.

Frequently Asked Questions about applying-testing-strategies

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

FAQPage Schema
How do I eliminate flaky Android instrumented tests caused by coroutines and animation timing?

To eliminate flaky Android instrumented tests, you must remove sources of non-determinism like coroutine delays, animation timing, randomness, and external state. This involves applying a determinism checklist for hermetic test execution.

What is the correct way to replace dependencies in Hilt UI testing?

Hilt UI testing dependency replacement requires using @HiltAndroidTest, HiltAndroidRule, and module replacement APIs like @TestInstallIn, @UninstallModules, and @BindValue. You must also enforce deterministic rule ordering and call inject().

How do I structure Android test suites using Given-When-Then?

Structuring Android test suites with Given-When-Then involves establishing a consistent Arrange-Act-Assert flow and a readable test method naming convention. This structure scales reliably and enables faster debugging.

When do I need @TestInstallIn versus @UninstallModules for Hilt testing?

You need @TestInstallIn and @UninstallModules for Hilt testing when replacing production modules in instrumented tests. Both APIs allow swapping dependencies, but @TestInstallIn provides the replacement module while @UninstallModules simply removes the original.

Why do my Android tests pass locally but fail in CI?

Android tests pass locally but fail in CI due to non-determinism from time dependencies, concurrency, animation timing, or external state. Structuring tests hermetically with dependency replacement eliminates these CI-only failures.

Can I use HiltAndroidRule with other JUnit rules for Android integration testing?

You can use HiltAndroidRule with other JUnit rules for Android integration testing, but you must enforce deterministic rule ordering. Correct rule ordering ensures Hilt dependency injection occurs reliably before test execution.