vitalikpestov/skills-catalog/android-kotlin-testing

Claude Code and agent skill by vitalikpestov/skills-catalog

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Android testing patterns — ViewModel unit tests with Turbine, Compose UI semantics, Hilt TestInstallIn fakes, coroutine test dispatchers, and release quality gates. Use when writing tests, setting up CI, mocking repositories, or asking "how to test ViewModel", "Compose UI test", "Turbine StateFlow".

Install

npx vskill@latest install vitalikpestov/skills-catalog/android-kotlin-testing

SKILL.md

The same SKILL.md was published earlier as vitalikpestov/skills-catalog/android-kotlin-testing.

Android Kotlin — Testing Module

Parent kit: `../../SKILL.md` · Index: `../../AGENTS.md`

Read First

FileWhen
`../../references/11-testing.md`Turbine, fakes, Compose test tags
`../../references/05-hilt-di.md`TestInstallIn modules
`../../references/13-release-checklist.md`Pre-ship checklist

ViewModel Test Template

kotlin
@OptIn(ExperimentalCoroutinesApi::class)
class FeatureViewModelTest {
@get:Rule
val mainDispatcherRule = MainDispatcherRule()
private val fakeRepo = FakeFeatureRepository()
private lateinit var viewModel: FeatureViewModel
@Before
fun setup() {
viewModel = FeatureViewModel(fakeRepo)
}
@Test
fun `refresh success clears loading`() = runTest {
fakeRepo.syncResult = Result.success(Unit)
viewModel.onEvent(FeatureUiEvent.Refresh)
viewModel.state.test {
skipItems(1)
val loading = awaitItem()
assertTrue(loading.isLoading)
val done = awaitItem()
assertFalse(done.isLoading)
assertNull(done.error)
}
}
}

Fake Over Mock

kotlin
class FakeFeatureRepository : FeatureRepository {
var syncResult: Result<Unit> = Result.success(Unit)
private val items = MutableStateFlow<List<Feature>>(emptyList())
override fun observeItems(): Flow<List<Feature>> = items
override suspend fun sync(): Result<Unit> = syncResult
}

Prefer fakes implementing real interfaces — tests behavior, not interaction order.

Compose UI Test

kotlin
class FeatureScreenTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun showsEmptyState() {
composeRule.setContent {
AppTheme {
FeatureContent(
state = FeatureUiState(items = emptyList()),
onEvent = {}
)
}
}
composeRule.onNodeWithTag("feature_empty").assertIsDisplayed()
}
}

Test stateless FeatureContent, not ViewModel-integrated screen.

What to Test vs Skip

Always testUsually skip
ViewModel state transitionsRoom generated SQL
Repository mappersHilt graph wiring (compile-time)
Error paths (Result.failure)Pixel-perfect screenshots
Critical user flows (instrumented)Third-party SDK internals

CI Gate

Repo skill validation must pass before merge:

bash
python3 scripts/validate_skills.py --strict

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
Repository forks
1
7-day trend score
10

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Grok Build (Cursor)
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/vitalikpestov/skills-catalog/android-kotlin-testing/badge)](https://verified-skill.com/skills/vitalikpestov/skills-catalog/android-kotlin-testing)

Something wrong with this skill or its page? Tell us.