/android-engineering-skills:android-testingfrom Android Engineering Skills
Defines testing standards for Android projects including JUnit 5, Turbine, Mockito/MockK, descriptive backtick test names, parameterized tests, and flow testing patterns. Use when creating, reviewing, or refactoring unit tests for ViewModels, use cases, mappers, calculators, repositories, or other pure Kotlin Android components.
Ships in Android Engineering Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill to create clear, behavior-focused tests for Android code.
Test behavior, not implementation.
Priorities:
Rules:
Use descriptive backtick names:
@Test
fun `When amount is valid then it returns parsed value`() { }
Rules:
Always name the subject being tested sut.
Example:
private lateinit var sut: ExchangeViewModel
Rules:
sut consistently in every test file.Organize tests into four blocks:
Example:
private val repository = mockk<ExampleRepository>()
private val sut = ExampleUseCase(repository)
@Test
fun `when repository returns data then ui state is loaded`() = runTest {
// create objects and mocks
val text = "mocked text"
val textA = "A"
val textB = "B"
val param = mockk<Param>() {
every { this.text } returns text
}
val expected = listOf(textA, textB)
// stub functions
every { repository.getData(param) } returns flowOf(Result.success(listOf(textA, textB)))
// execute tested function
val actual = sut(text)
// assert result
assertEquals(expected = expected, actual = actual.first().getOrThrow())
}
Rules:
expected name for the object expected to be the result.actual name for the resultof the tested function.Prefer complete assertions over partial checks.
Good:
assertEquals(expected = expectedUiState, actual = actualUiState)
Better when collections matter:
assertEquals(expected = expectedItems, actual = actualItems)
Use partial assertions only when the test is explicitly about a small part of the output and the rest is irrelevant.
Rules:
Use the following stack:
runTest for coroutine testsRules:
@Test from JUnit 5.runTest for suspending code and Flow collection.Use Turbine whenever testing Flow or StateFlow behavior.
Common assertions:
awaitItem()awaitComplete()awaitError()expectNoEvents()Example:
@Test
fun `When flow emits values, then it receives them in order`() = runTest {
val flow = flowOf(1, 2, 3)
flow.test {
assertEquals(expected = 1, actual = awaitItem())
assertEquals(expected = 2, actual = awaitItem())
assertEquals(expected = 3, actual = awaitItem())
awaitComplete()
}
}
Rules:
Use parameterized approaches whenever multiple input and output combinations exist.
Prefer:
@ParameterizedTest@MethodSource@CsvSource@EnumSource@TestFactory for dynamic testsUse @TestFactory or dynamic tests when scenarios are naturally data driven and the body should stay compact.
Example:
@TestFactory
fun `When amounts are invalid, then parser returns zero`() = listOf(
"a" to BigDecimal.ZERO,
"" to BigDecimal.ZERO,
).map { (input, expected) ->
dynamicTest("input = $input") {
val actual = sut.parse(input)
assertEquals(expected = expected, actual = actual)
}
}
Rules:
Use runTest for all coroutine based tests.
Rules:
Useful checks:
Test ViewModels through their public API.
Prefer testing:
onActionuiStateuiEventsRules:
Test the input to output contract.
Test exact mapped values.
Test interaction with dependencies and returned domain results.
Rules:
Before merging a test, confirm:
sut is used consistentlyrunTestIf a test is hard to read, hard to extend, or tied too closely to implementation details, rewrite it.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
android-testing, junit5, mockk, turbine, unit-testing, kotlin-testing
npx claudepluginhub lennonpetrick/android-engineering-skills --plugin android-engineering-skills3 skills in this plugin
/android-architectureDefines project structure, package layout, layer boundaries, naming conventions, and dependency injection setup for Android projects. Use this skill whenever creating a new Android project, adding a new feature module, scaffolding a new screen or flow, setting up DI bindings, naming any class or file, or deciding which layer a piece of code belongs in. Also use it when reviewing or refactoring existing code to ensure it follows the established architecture./android-patternsDefines all implementation patterns for Android features: Unidirectional Data Flow (UDF), ViewModel design, Flow composition, error handling, repository pattern, domain UseCases, and Compose UI patterns. Use this skill whenever implementing a ViewModel, designing state or action models, writing a repository or UseCase, composing Flows, handling errors, building Compose screens or components, or reviewing code for correctness of reactive patterns or state management.2 plugins ship this exact skill · first indexed Oct 17, 2026
Other plugins' skills for the same job