0
0
Android Kotlinmobile~5 mins

Repository testing with fakes in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a fake in repository testing?
A fake is a simple implementation of a repository or data source used in tests to simulate real behavior without accessing real databases or network. It helps test logic in isolation.
Click to reveal answer
intermediate
Why use fakes instead of mocks in repository testing?
Fakes provide a working implementation with simple logic, making tests more realistic and easier to maintain compared to mocks, which only simulate behavior and require setup for each test.
Click to reveal answer
beginner
How does a fake repository improve test reliability?
By using a fake repository, tests run quickly and consistently without relying on external systems like databases or network, reducing flakiness and making debugging easier.
Click to reveal answer
intermediate
What is a key difference between a fake and a stub?
A fake has a working implementation with simple logic, while a stub only returns fixed data without any logic.
Click to reveal answer
beginner
In Kotlin, how might you implement a fake repository for testing?
Create a class implementing the repository interface with in-memory data structures to store and return data, simulating real repository behavior without external dependencies.
Click to reveal answer
What is the main purpose of using a fake repository in tests?
ATo replace UI components
BTo slow down tests for accuracy
CTo simulate real data access without external dependencies
DTo connect to a real database
Which of these is true about a fake repository?
AIt has simple logic and stores data in memory
BIt is used only for UI testing
CIt only returns fixed data without logic
DIt contains real database connections
Why might you prefer a fake over a mock in repository testing?
AFakes provide a working implementation making tests more realistic
BMocks are slower than fakes
CMocks require no setup
DFakes connect to real services
What is a common data storage method inside a fake repository?
AFile system storage
BIn-memory collections like lists or maps
CRemote server calls
DDatabase queries
Which statement about repository testing with fakes is false?
AFakes implement repository interfaces
BFakes help isolate tests from external systems
CFakes improve test speed and reliability
DFakes always connect to real databases
Explain how a fake repository works and why it is useful in testing Android apps.
Think about how you can test data logic without using a real database or network.
You got /5 concepts.
    Describe the difference between a fake, a mock, and a stub in repository testing.
    Focus on how each one behaves and what they provide in tests.
    You got /5 concepts.