android-unit-test-editor

Generate Android unit tests for ViewModels, Use Cases, and Repositories using Kotlin, MockK, and Turbine.

7|2|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/javiercamarenatriguero/android-skills --skill android-unit-test-editor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-unit-test-editor
Source: https://github.com/javiercamarenatriguero/android-skills/tree/main/android-unit-test-editor
Command: npx skills add https://github.com/javiercamarenatriguero/android-skills --skill android-unit-test-editor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing effective unit tests for Android applications, ensuring code quality and reliability.

Core Features & Use Cases

  • Structured Testing: Implements the GIVEN/WHEN/THEN naming convention for clear and maintainable tests.
  • Mocking with MockK: Provides examples for mocking dependencies using MockK.
  • Coroutine Testing: Demonstrates how to test Kotlin Coroutines and Flows using kotlinx.coroutines.test and Turbine.
  • Use Case: Quickly generate unit tests for your ViewModels, Use Cases, and Repositories following best practices.

Quick Start

Use the android-unit-test-editor skill to generate a unit test for a ViewModel that fetches data from a repository.

Frequently Asked Questions about android-unit-test-editor

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

FAQPage Schema
How do I write unit tests for Android ViewModels using coroutines?

To write unit tests for Android ViewModels using coroutines, use kotlinx.coroutines.test for dispatcher control and MockK to mock repository dependencies. Structure ViewModel tests using GIVEN/WHEN/THEN naming conventions to verify data fetching logic and state updates.

What's the best way to test Kotlin Flows in Android unit tests?

The best way to test Kotlin Flows in Android unit tests is using Turbine. Turbine allows you to collect and assert emissions over time, verifying flow values and exceptions effectively while maintaining structured coroutine testing standards.

How do I mock dependencies for Android Use Case and Repository tests?

Mock dependencies for Android Use Case and Repository tests using MockK. Define mock behaviors and return values for repository interfaces within your test classes to isolate Use Case logic and validate business rules without requiring real data sources.

Does this Android testing approach use GIVEN/WHEN/THEN naming conventions?

Yes, this Android testing approach uses GIVEN/WHEN/THEN naming conventions. Structuring tests this way ensures clear, maintainable unit test documentation by separating setup, execution, and assertion phases across ViewModels, Use Cases, and Repositories.

Can I use MockK and Turbine together for comprehensive Android unit testing?

Yes, you can use MockK and Turbine together for comprehensive Android unit testing. MockK handles dependency mocking for Use Cases and Repositories, while Turbine tests Flow emissions, ensuring complete coverage of coroutine-based Android architecture components.