Skip to content
Back to skills

Android Testing

ASecurity

Standards for Unit Tests, UI Tests (Compose), and Hilt Integration. Use whenever writing Android test files or asking about runTest, composeTestRule, HiltAndroidRule, MockK, MainDispatcherRule, @TestInstallIn, or how to test a ViewModel/Composable/Repository in Android. (triggers: **/*Test.kt, **/*Rule.kt, @Test, runTest, composeTestRule, HiltAndroidTest, MockK, createAndroidComposeRule, MainDispatcherRule, @TestInstallIn)

  • 43 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
developmentkotlintesting

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ComeOnOliver/skillshub --skill android-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/comeonoliver-android-testing/badge)](https://www.skillsdirectory.com/skills/comeonoliver-android-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: android-testing
description: "Standards for Unit Tests, UI Tests (Compose), and Hilt Integration. Use whenever writing Android test files or asking about runTest, composeTestRule, HiltAndroidRule, MockK, MainDispatcherRule, @TestInstallIn, or how to test a ViewModel/Composable/Repository in Android. (triggers: **/*Test.kt, **/*Rule.kt, @Test, runTest, composeTestRule, HiltAndroidTest, MockK, createAndroidComposeRule, MainDispatcherRule, @TestInstallIn)"
---

# Android Testing Standards

## **Priority: P0**

## Implementation Guidelines

### Unit Tests

- **Scope**: ViewModels, Usecases, Repositories, Utils.
- **Coroutines**: Use `runTest` (kotlinx-coroutines-test). Use `MainDispatcherRule` to mock Main dispatcher.
- **Mocking**: Use MockK.

### UI Integration Tests (Instrumentation)

- **Scope**: Composable Screens, Navigation flows.
- **Rules**: Use `createAndroidComposeRule` + Hilt (`HiltAndroidRule`).
- **Isolation**: Fake repositories in DI modules (`@TestInstallIn`).

## Anti-Patterns

- **No Real Network in Tests**: Always mock with MockK or fake repositories via @TestInstallIn.
- **No Thread.sleep**: Use IdlingResource or composeTestRule.waitUntil for async timing.

## References

- [Test Rules](references/implementation.md)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…