What is the difference between ActivityTestRule and IntentTestRule
1 answer
Purpose :
to initialize Espresso-Intents before each test, annotated with @Test and issues Espresso-Intents after each test run.
@Override
protected void afterActivityLaunched() {
Intents.init();
super.afterActivityLaunched();
}
@Override
protected void afterActivityFinished() {
super.afterActivityFinished();
Intents.release();
}
you can use
ActivityTestRule
instead ofIntentsTestRule
, then in yours@Before
and@After
call manuallyIntents.init()
andIntents.release()
accordingly.
And the purpose of espresso intentions is
to enable validation and completion of intents sent to the application under test. This is similar to Mockito, but for Android Intents.
+3
source to share