android-testing

Standardize JUnit5, Turbine, and Compose UI test patterns for Android and KMP apps.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/kvithayathil/agent-resources --skill android-testing-kvithayathil
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-testing
Source: https://github.com/kvithayathil/agent-resources/tree/main/skills/android/android-testing
Command: npx skills add https://github.com/kvithayathil/agent-resources --skill android-testing-kvithayathil

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing reliable, maintainable tests for Android and Kotlin Multiplatform (KMP) apps often requires repetitive boilerplate and inconsistent patterns, leading to flaky tests and wasted development time.

Core Features & Use Cases

  • Standardized Test Setup: Pre-defined configurations for JUnit5, Turbine, AssertK, and UnconfinedTestDispatcher to streamline coroutine and StateFlow testing.
  • Fake Repository Patterns: Reusable in-memory fake implementations that eliminate brittle mocks for data layer unit tests.
  • Compose UI & Robot Pattern: Templates for ComposeTestRule UI tests and the Robot pattern to simplify complex multi-step end-to-end test flows. Use case: For example, use this skill to quickly write unit tests for a NoteListViewModel that verify loading states and one-time event emissions, or build maintainable E2E tests for a multi-screen note-taking app flow.

Quick Start

Use the android-testing skill to write a unit test for your ViewModel that verifies state emissions and event handling using Turbine and AssertK.

Frequently Asked Questions about android-testing

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

FAQPage Schema
How do I test StateFlow emissions in my Android ViewModel?

To test StateFlow emissions in Android ViewModels, use Turbine alongside UnconfinedTestDispatcher to verify loading states and one-time event emissions predictably without flaky behavior.

What is the best way to write Compose UI tests for multi-screen flows?

The best way to write Compose UI tests for multi-screen flows is using the Robot pattern with ComposeTestRule, which simplifies complex multi-step end-to-end user interactions into maintainable test scripts.

How do I set up JUnit5 for Kotlin Multiplatform testing?

To set up JUnit5 for Kotlin Multiplatform testing, apply standardized configurations for JUnit5, Turbine, AssertK, and UnconfinedTestDispatcher to streamline coroutine and StateFlow testing across platforms.

Why should I use fake repositories instead of mocks for data layer unit tests?

You should use fake repositories instead of mocks for data layer unit tests because reusable in-memory fake implementations eliminate brittle mocks, creating more reliable and maintainable test setups.

Can I use this Android testing approach for Kotlin Multiplatform apps?

Yes, you can use this Android testing approach for Kotlin Multiplatform apps, as the standardized patterns for JUnit5, Turbine, and fake repositories are designed to support KMP applications directly.

How do I instantiate SavedStateHandle in my ViewModel unit tests?

To instantiate SavedStateHandle in ViewModel unit tests, use the provided standardized patterns for SavedStateHandle test instantiation to verify state preservation logic without repetitive boilerplate.