0
0
Android Kotlinmobile~5 mins

Instrumented tests in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are instrumented tests in Android development?
Instrumented tests run on a real device or emulator and can interact with the Android framework and UI components.
Click to reveal answer
beginner
Which Android testing framework is commonly used for instrumented tests?
Espresso is commonly used for instrumented UI tests in Android to simulate user interactions.
Click to reveal answer
beginner
Where are instrumented test files located in an Android project?
They are located in the src/androidTest/java directory of the project.
Click to reveal answer
intermediate
What annotation is used to mark an instrumented test class in Android?
The @RunWith(AndroidJUnit4::class) annotation marks a class to run with the AndroidJUnit4 test runner.
Click to reveal answer
beginner
Why do instrumented tests require a device or emulator to run?
Because they interact with Android system components and UI, which only exist on a device or emulator.
Click to reveal answer
Where do instrumented tests run?
AOn a real device or emulator
BOn the local JVM without Android framework
COnly on physical devices
DOnly on desktop computers
Which directory contains instrumented test code in an Android project?
Asrc/main/java
Bsrc/test/java
Csrc/resources
Dsrc/androidTest/java
Which annotation is used to specify the test runner for instrumented tests?
A@RunWith(AndroidJUnit4::class)
B@Ignore
C@Before
D@Test
What is Espresso used for in Android instrumented tests?
AWriting local unit tests
BSimulating user interactions with UI
CBuilding APK files
DManaging app permissions
Why can't instrumented tests run on the local JVM alone?
AThey need internet access
BThey require special hardware
CThey require Android system APIs and UI components
DThey only test backend logic
Explain what instrumented tests are and why they are important in Android development.
Think about how you test the app like a user on a phone.
You got /4 concepts.
    Describe the typical setup and annotations needed to write an instrumented test in Kotlin for Android.
    Consider where the code lives and how the test runner is specified.
    You got /4 concepts.