android-tdd

Guide Android/KMP TDD with three-tier testing for ViewModels, Repositories, DAOs, and Compose UI.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/kotlinknight/NutriSoloAndroid --skill android-tdd-kotlinknight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-tdd
Source: https://github.com/kotlinknight/NutriSoloAndroid/tree/main/.agents/skills/android-tdd
Command: npx skills add https://github.com/kotlinknight/NutriSoloAndroid --skill android-tdd-kotlinknight

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Android/KMP projects often struggle to apply true test-driven development due to Android-specific patterns, UI concerns, and asynchronous code; this skill guides how to integrate TDD with Android realities.

Core Features & Use Cases

  • Android-specific TDD patterns: three-tier testing, fake-first strategy, coroutine testing, and Compose UI testing.
  • Practical guidance: choosing unit/integration/instrumented levels, preference for fakes over mocks, and tooling recommendations (Turbine, Roborazzi).
  • Real-world scenarios: testing ViewModels, Repositories, DAOs, and Compose UI components in Android/KMP apps.

Quick Start

Begin by selecting the lowest viable test tier for your Android module and write a failing test that drives the implementation, then refactor to pass it using the Android TDD cycle.

Frequently Asked Questions about android-tdd

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

FAQPage Schema
How do I apply test-driven development to Android ViewModels and Repositories using Kotlin coroutines?

Apply TDD to Android ViewModels and Repositories by selecting the unit test tier and writing failing tests that drive the implementation using coroutine testing patterns with runTest. This approach guides you to implement code through the Android TDD cycle before refactoring to pass the test.

What is the best way to test Compose UI components in an Android TDD workflow?

The best way to test Compose UI components in an Android TDD workflow is using instrumented testing with specific Compose UI testing rules. This ensures your UI components meet the required behavior by driving the implementation through failing UI tests before writing the actual Compose code.

Should I use fakes or mocks when writing Android Kotlin tests?

You should use fake implementations over mocks when writing Android Kotlin tests. This fake-first strategy provides more reliable and maintainable tests by utilizing real implementations of your interfaces rather than relying on mock frameworks that can tightly couple tests to implementation details.

Does this Android testing approach support Hilt dependency injection patterns?

Yes, this Android testing approach explicitly supports Hilt testing patterns. It integrates Hilt dependency injection into the three-tier testing model, allowing you to write and execute tests for ViewModels, Repositories, and DAOs that rely on Hilt-provided dependencies.

How do I choose between unit, integration, and instrumented testing for my KMP modules?

Choose between unit, integration, and instrumented testing by selecting the lowest viable test tier for your specific Android or KMP module. This three-tier testing model ensures you start with the fastest, most isolated tests possible before moving to higher-level integration or instrumented tests.

Can I use Roborazzi for screenshot testing within an Android TDD cycle?

Yes, you can use Roborazzi for screenshot testing within an Android TDD cycle. The testing guidance includes Roborazzi-based screenshot testing patterns to capture and verify UI rendering, ensuring your visual implementation matches expected outcomes after driving the code through test failures.