android-unit-test

Guide Android testing with JUnit, Espresso, Mockito, and MockK.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dengineproblem/agents-monorepo --skill android-unit-test-dengineproblem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-unit-test
Source: https://github.com/dengineproblem/agents-monorepo/tree/main/.claude/skills/android-unit-test
Command: npx skills add https://github.com/dengineproblem/agents-monorepo --skill android-unit-test-dengineproblem

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides expert guidance and code examples for writing robust unit and instrumentation tests for Android applications, ensuring code quality and reliability.

Core Features & Use Cases

  • Unit Testing: Comprehensive examples for testing business logic, ViewModels, and Repositories using JUnit, Mockito, and MockK.
  • Instrumentation Testing: Demonstrations of UI testing with Espresso for verifying user interface interactions and flows.
  • Testing Patterns: Illustrates best practices like AAA, Test Data Factories, and custom assertions.
  • Use Case: You need to write unit tests for a new Android ViewModel that fetches user data. This Skill provides the exact code structure, dependency setup, and assertion examples to get you started quickly.

Quick Start

Use the android-unit-test skill to generate a JUnit test for an Android ViewModel.

Frequently Asked Questions about android-unit-test

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

FAQPage Schema
How do I write a unit test for an Android ViewModel using Kotlin?

To write a unit test for an Android ViewModel, you can use JUnit alongside Mockito or MockK to isolate dependencies, verify business logic, and assert state changes within your Kotlin code.

What is the best way to test Android UI components with Espresso?

Testing Android UI components with Espresso involves writing instrumentation tests that simulate user interactions and verify UI flows, ensuring your application's user interface behaves reliably.

How do I apply the AAA pattern when testing Android Repositories?

Applying the AAA pattern when testing Android Repositories involves structuring tests into Arrange, Act, and Assert phases, allowing you to set up test data factories and cleanly validate repository logic.

Can I use MockK and Mockito together for Android parameterized tests?

Yes, you can use JUnit's parameterized tests with either MockK or Mockito to run the same test logic against multiple inputs, ensuring comprehensive coverage for your Android application's varied scenarios.

Does this guidance cover setting up dependency configurations for Android instrumentation testing?

This guidance covers setting up your testing strategy by providing the exact code structure and dependency setup required for both unit testing logic and instrumentation testing UI components.