بنقرة واحدة
android-unit-testing
Use when writing or fixing unit tests, mocking objects, or testing reactive flows in Android.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when writing or fixing unit tests, mocking objects, or testing reactive flows in Android.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Handling Bluetooth Low Energy, flow wrappers, and Android 12+ permissions.
Seamless integration of CameraX with Google ML Kit for vision tasks.
Deep-dive skills for banking and healthcare apps.
Use when integrating Google Gemini Nano via AICore for on-device ML.
Automated UIAutomator tests and Hardware mocking setup.
Expanding KMP shared UI to cover Compose Multiplatform edge-cases.
| name | android-unit-testing |
| description | Use when writing or fixing unit tests, mocking objects, or testing reactive flows in Android. |
| category | testing |
| risk | low |
| source | community |
| date_added | 2026-03-31 |
| metadata | {"triggers":["@android-testing","junit-5","mockk","turbine-testing","unit-test"]} |
The ultimate guide to writing robust, reliable, and maintainable unit tests for Android applications using modern tools like MockK, Turbine, and Coroutine Test.
Flow and StateFlow.@Test, @BeforeEach, and @DisplayName for clear tests.every { ... } returns ... and coEvery { ... } returns ... for suspend functions.
val repository = mockk<UserRepository>()
coEvery { repository.getUser("123") } returns User("John")
collect or first() in tests manually. Use Turbine.
flow.test {
assertEquals(1, awaitItem())
assertEquals(2, awaitItem())
awaitComplete()
}
runTestrunTest skips delay() and ensures tests run fast and predictably.Dispatchers.IO or Main. Inject them.StandardTestDispatcher or UnconfinedTestDispatcher.Dispatchers.setMain(testDispatcher) is called before and Dispatchers.resetMain() after tests.FakeLocalSource or FakeRemoteSource for complex integration tests.user.name shouldBe "John").test_whenQueryChanged_updatesState.verify { ... }.