android-testing

Guide Android unit, Hilt integration, and Compose UI screenshot tests.

915|88|Updated Feb 6, 2024
One-click install
npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-testing-new-silvermoon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-testing
Source: https://github.com/new-silvermoon/awesome-android-agent-skills/tree/main/.github/skills/android-testing
Command: npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-testing-new-silvermoon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires junit4, kotlinx-coroutines-test, androidx-test-ext-junit, espresso-core, compose-ui-test, hilt-android-testing, roborazzi.

What problem does it solve?

This Skill provides a structured approach to Android testing, enabling teams to implement a cohesive testing strategy that covers Unit tests, Hilt integration tests, and UI/Screenshot tests to improve reliability and reduce flaky behavior.

Core Features & Use Cases

  • Unit Testing Guidance: scaffolds ViewModel and Repository tests with clear patterns for state handling and coroutines.
  • Hilt Integration Testing: sets up DI graphs for isolated component tests, enabling repeatable test environments.
  • UI/Screenshot Testing: outlines strategies for Compose UI tests and visual regression using Roborazzi.

Quick Start

Use the android-testing skill to scaffold a baseline test suite in a new or existing Android project.

Frequently Asked Questions about android-testing

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

FAQPage Schema
How do I structure Android testing for ViewModels and Repositories using coroutines?

Android ViewModel and Repository testing requires scaffolding with clear patterns for state handling and coroutines. Using JUnit4 and kotlinx-coroutines-test provides structured unit test creation to validate state management and coroutine behavior.

What's the best way to set up Hilt integration tests for isolated Android components?

Hilt integration testing sets up dependency injection graphs for isolated component tests, enabling repeatable test environments. Using hilt-android-testing ensures your DI configuration is validated across isolated test scenarios without manual graph management.

Can I use Roborazzi for Compose UI screenshot tests and visual regression?

Yes, Roborazzi enables Compose UI screenshot testing and visual regression validation. The testing strategy combines compose-ui-test for interaction checks with Roborazzi to capture and compare UI screenshots, reducing flaky visual behavior.

Does this Android testing approach work with Espresso and AndroidX test extensions?

Yes, the testing strategy enforces requirements for AndroidX test extensions and Espresso core. It applies to modern Android apps across various Gradle setups, ensuring comprehensive UI testing coverage alongside Compose UI tests.

Why do my Android UI tests have flaky behavior and how can I standardize them?

Flaky Android UI tests often stem from unstructured test environments and inconsistent execution strategies. Standardizing with Espresso, Compose UI testing, and Roborazzi screenshot tests improves reliability by enforcing repeatable test structures.