Join Chiu-Ki Chan for an in-depth discussion in this video Outgoing intents: How to match?, part of Advanced Android Espresso Testing.
- [Instructor] We called hasExtra…to match the intent extra.…How did I know I should use hasExtra?…What if we want to match the activity being launched?…What if we want to verify the idea's activity…is the one that's getting launched?…We can pour through the documentation,…but that's a lot of functions,…and it's a bit hard to figure out which one works best.…Instead, we can create an intent matcher…that measures all intents and examine the intent…that got intercepted.…
Let's do that.…As a starting point, we will take a look…at the any intent intent matcher…that comes with the Espresso-Intents Library.…Go to the end of the punnyIntended function…and add a new line with IntentMatches.anyIntent.…Command click to take a look at the code.…Here you can see that it matches all intents…because on line 54 the match safely function…simply returns true.…
Copy and paste all of it into our test.…It asked us to convert from Java to Kotlin.…Let's do that.…Then go back to line 46 and delete it.…Next put your cursor on line 44…where we call intended…
- 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.