Component - Instrumented tests
Instrumented tests run on a real or virtual Android device. They check how your app behaves in a real environment, including UI interactions and system integration.
Instrumented tests run on a real or virtual Android device. They check how your app behaves in a real environment, including UI interactions and system integration.
AndroidJUnitRunner
└── ActivityScenario
└── ViewMatchers
└── ViewActions
└── ViewAssertionsval appContext = InstrumentationRegistry.getInstrumentation().targetContext val packageName = appContext.packageName println(packageName)
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
val context = InstrumentationRegistry.getContext()
assertEquals("com.example.app", context.packageName)
}
}Pass the test and this pattern moves unknown