See: Description
| Class | Description |
|---|---|
| EspCameraStub |
Stubbing camera picture request with
MediaStore.ACTION_IMAGE_CAPTURE. |
| EspContactStub |
Stubbing contact request with
Intent.ACTION_PICK. |
| EspGalleryStub |
Stubbing gallery picture request with
Intent.ACTION_GET_CONTENT and MediaType.ANY_IMAGE_TYPE. |
Validation and stubbing of Intents sent out by the application.
Many apps sent Intents to use third party applications but Espresso does only work in your app scope. A solution could be to use UiAutomator to handle third party Activities. But the preferred way is to stub the third party applications and let them report your configured result.
For Intent stubbing you must use the IntentsTestRule or it will not work. (Necessary dependencies already provided by Espresso Macchiato library)
public class MyTest {
@Rule
public IntentsTestRule<MyActivity> activityTestRule = new IntentsTestRule<>(MyActivity.class);
}
For more details about testing with Intents see Espresso documentation.
A registered stub works for multiple requests until your test is done. You can have multiple stubs registered then the best matching one will be used automatically.