Join Chiu-Ki Chan for an in-depth discussion in this video Failing test, part of Advanced Android Espresso Testing.
- Let's run main activity test.…Move your cursor to the gutter on line 16.…Click on the green triangle,…and choose Run 'MainActivityTest.'…Choose your device and press OK.…The test fails because it is trying…to look for something that is not yet available.…Take a look at the error message.…It complains that on line 24 we want…to have the text view displaying the text, done.…
But it's not yet ready because in our app…it takes a little bit of time for the loading dialog…to process whatever it's doing…and then dismiss itself to show this text view.…Now how do we tell Espresso to wait?…You may be tempted to put in a sleep statement,…but that is very fragile.…In this example, we artificially put in a three-second delay…to simulate loading, but in the real world,…the network call can be longer or shorter…depending on the situation.…
Instead of a sleep statement, we will ask Espresso…to wait until the loading dialog dismisses.…In the real app, the dialogue will be dismissed…when the network call completes.…We are using this visual cue to signal to us…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m 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.