Android Testing Advanced
Advanced Android testing: TDD, mocking, Coroutines, Flow, Compose UI, and test coverage
1How do Mock, Stub, and Fake differ in tests?
How do Mock, Stub, and Fake differ in tests?
Câu trả lời
A Mock verifies interactions (who calls what, how many times, with which arguments). A Stub returns predefined responses without verification. A Fake is a simplified working implementation (e.g., in‑memory repository). Mocks emphasize behavior verification, Stubs support state verification, and Fakes provide lightweight realistic alternatives.
2How to use MockK for mocking in Kotlin?
How to use MockK for mocking in Kotlin?
Câu trả lời
MockK is Kotlin‑centric: mockk<T>() creates a double, every { ... } returns ... stubs responses, verify { ... } checks interactions. It supports coroutines (coEvery/coVerify), relaxed mocks, and argument capture via slot.
3What is TDD (Test-Driven Development)?
What is TDD (Test-Driven Development)?
Câu trả lời
TDD means writing a test before the code and iterating Red‑Green‑Refactor: failing test, minimal code to pass, then refactor without changing behavior. Benefits: better coverage, more testable design, living documentation.
How to test Coroutines with runTest?
How to test Flow?
+15 câu hỏi phỏng vấn
Các chủ đề phỏng vấn Android khác
Android Fundamentals
Android UI and Resources
Android Lifecycle
Android Navigation
Android Data Management
Android Networking
Android Testing
Android Gradle
Kotlin Language Essentials for Android
Room Database
Background Work
Jetpack Compose
Permissions and Device Features
Firebase for Android
Android MVVM Architecture
Advanced Android Networking
Kotlin Collections and Operators
Kotlin Coroutines and Flow
Android Dependency Injection
Android MVI Architecture
Android Clean Architecture
Android Compose Advanced
Android Performance and Monitoring
Android Security and Privacy
Android CI/CD and Release
Android UX and Form Factors
Nắm vững Android cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí