Skip to content
Back to skills

Mobile Testing

ASecurity

Android testing patterns with JUnit5, Mockk, Turbine, and Compose testing for unit, integration, and UI tests.

  • 65 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 7, 2026
developmentkotlinbashnodetestingapi

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add ahmed3elshaer/everything-claude-code-mobile --skill mobile-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mobile Testing?

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

Security grade badge for Mobile Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ahmed3elshaer-mobile-testing/badge)](https://www.skillsdirectory.com/skills/ahmed3elshaer-mobile-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: mobile-testing
description: Android testing patterns with JUnit5, Mockk, Turbine, and Compose testing for unit, integration, and UI tests.
---

# Mobile Testing Patterns

Comprehensive testing for Android.

## Test Dependencies

```kotlin
// build.gradle.kts
dependencies {
    testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
    testImplementation("io.mockk:mockk:1.13.8")
    testImplementation("app.cash.turbine:turbine:1.0.0")
    testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0")
    testImplementation("io.kotest:kotest-assertions-core:5.8.0")
    
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
}
```

## ViewModel Testing

```kotlin
class HomeViewModelTest {
    @MockK private lateinit var repository: HomeRepository
    private lateinit var viewModel: HomeViewModel

    @BeforeEach
    fun setup() {
        MockKAnnotations.init(this)
        viewModel = HomeViewModel(repository)
    }

    @Test
    fun `loads items successfully`() = runTest {
        coEvery { repository.getItems() } returns Result.success(listOf(item))

        viewModel.state.test {
            viewModel.onIntent(LoadItems)
            awaitItem().isLoading shouldBe true
            awaitItem().items shouldBe listOf(item)
        }
    }
}
```

## Repository Testing

```kotlin
class UserRepositoryTest {
    @MockK private lateinit var api: UserApi
    private lateinit var repository: UserRepository

    @Test
    fun `getUser returns mapped domain model`() = runTest {
        coEvery { api.getUser("1") } returns UserDto("1", "John")

        val result = repository.getUser("1")

        result.isSuccess shouldBe true
        result.getOrNull()?.name shouldBe "John"
    }
}
```

## Compose UI Testing

```kotlin
class HomeScreenTest {
    @get:Rule
    val rule = createComposeRule()

    @Test
    fun `displays items`() {
        rule.setContent {
            HomeContent(state = HomeState(items = listOf(item)))
        }

        rule.onNodeWithText(item.name).assertIsDisplayed()
    }
}
```

## Coverage Target: 80%

```bash
./gradlew koverHtmlReport
```

---

**Remember**: Test behavior, not implementation. Write tests first.

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.