Agent-skills-standard android-testing
Write Unit Tests, UI Tests (Compose), and Hilt-integrated tests for Android. 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)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/android/android-testing" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-android-testing && rm -rf "$T"
manifest:
skills/android/android-testing/SKILL.mdsource content
Android Testing Standards
Priority: P0
Implementation Guidelines
Unit Tests
- Scope: ViewModels, Usecases, Repositories, Utils.
- Coroutines: Use
(kotlinx-coroutines-test). UserunTest
to mock Main dispatcher.MainDispatcherRule - Mocking: Use MockK.
UI Integration Tests (Instrumentation)
- Scope: Composable Screens, Navigation flows.
- Rules: Use
+ Hilt (createAndroidComposeRule
).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.