Join Chiu-Ki Chan for an in-depth discussion in this video Incoming intents: Known theme, part of Advanced Android Espresso Testing.
- [Instructor] To launch an activity with a specific intent,…we pass the intent as a parameter…to launch the activity rule.…Press Command + N to create a new test function.…Call it punny, because we are going to display…punny cat names.…Remove the TODO.…We will create an intent and put punny…as the intent extra with the key theme.…
On line 28, add val intent = Intent.…Alt + Enter to import intent,…then intent.putExtra.…We will give it the key, IdeasActivity.KEY_THEME,…and then the string Punny.…
After that we can use this intent to launch the activity.…ActivityRule.launchActivity and then intent.…With that we want to verify that the theme is Punny.…Copy the code on line 23 to 24.…Paste it after you launch the activity.…
Instead of verifying that it has…the text missing_theme on line 34,…replace with the string, Punny.…Let's run the test, and see what it does.…Go to the gutter,…and on line 28 click on the green triangle…and run just the Punny method instead…of every method in this test.…Choose your device, and press OK.…
- 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.