Join Chiu-Ki Chan for an in-depth discussion in this video Using idling resource, part of Advanced Android Espresso Testing.
- Go to MainActivityTest.…In the beginning of the test method,…before we check the text view,…we need to create and register an idling resource.…On line 23 type…val idlingResource = DialogFragmentIdlingResource,…and then we will need to give it a fragment manager.…ActivityRule.activity.supportFragmentManager.…
Then the next parameter is the string tag…that we are using for the dialog.…It is defined as a constant in loading dialog fragment.…LoadingDialogFragment.TAG.…Once we have created the idling resource,…we need to register it with Espresso.…IdlingRegistry.getInstance.register,…and then idlingResource.…
This means that we are asking Espresso…to make sure that the dialog…is not displaying before proceeding.…After we register the idling resource,…we can go ahead and verify the text view.…After that we don't need to monitor the dialog any more,…so let's unregister the idling resource.…On line 30, type…IdlingRegistry….getInstance….unregisteridlingResource.…
Let's run the test.…Now Espresso waits for the dialog to dismiss…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis3h 59m Intermediate
2. Hermetic Test Environment
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.