android-testing

Guide Android/Kotlin test implementation across the full test pyramid.

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/eric-sabe/engsys --skill android-testing-eric-sabe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-testing
Source: https://github.com/eric-sabe/engsys/tree/main/stacks/lang/kotlin/skills/android-testing
Command: npx skills add https://github.com/eric-sabe/engsys --skill android-testing-eric-sabe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the confusion and inconsistency of writing Android/Kotlin tests by providing clear, standardized guidance for selecting the right testing tools and patterns for every layer of the test pyramid, reducing flaky tests and wasted debugging time.

Core Features & Use Cases

  • Full Test Pyramid Support: Covers JUnit unit tests, MockK mocking, Turbine for Flow/StateFlow assertions, kotlinx-coroutines-test for coroutine testing, Robolectric JVM tests, Compose UI testing, and Espresso instrumented UI tests.
  • Best Practice Guardrails: Includes guidance to avoid common anti-patterns like Thread.sleep, over-mocking, and misplacing tests in the wrong source set, plus a review checklist to ensure test quality.
  • Use Case: A developer building an Android app with ViewModels and Compose UI can use this Skill to write fast, reliable unit tests for business logic, Compose UI tests with stable semantic selectors, and a thin layer of instrumented end-to-end tests, all following industry best practices.

Quick Start

Use the android-testing skill to write a unit test for your Android ViewModel that verifies it emits a loading state followed by a loaded state when fetching data, using Turbine for Flow assertions and a MainDispatcherRule for coroutine testing.

Frequently Asked Questions about android-testing

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

FAQPage Schema
How do I test Kotlin coroutines and Flows without making my Android unit tests flaky?

You can test Android ViewModel state emissions by writing unit tests that combine Turbine for Flow assertions and a MainDispatcherRule for coroutine testing, verifying loading and loaded states sequentially.

Does Compose UI testing support semantic selectors for stable instrumented tests?

You can avoid common Android testing anti-patterns like Thread.sleep, over-mocking, and misplacing tests in wrong source sets by adhering to behavior-focused testing best practices and standardized guardrails.

What's the best way to mock dependencies when writing JVM unit tests for Android business logic?

Robolectric allows you to write JVM tests for code dependent on the Android framework by simulating the environment locally, eliminating the slow execution times typical of instrumented tests.

When should I write Espresso instrumented end-to-end tests instead of Robolectric tests?

The Android test pyramid structure prioritizes fast unit tests for business logic, a middle layer of Robolectric and Compose UI tests, and a thin layer of Espresso instrumented end-to-end tests.