Join Chiu-Ki Chan for an in-depth discussion in this video Stubbing: ActivityResult, part of Advanced Android Espresso Testing.
- [Instructor] Let's add a new test function…to use intending to stop the activity result.…Press command N to create a new test function.…Call it Punny Intending.…Delete the To Do.…Then we are going to be using Intending…with the same intent measure as before.…Copy the lines 45 to 47.…
Instead of Intended,…we are going to change it to Intending on line 56.…This means that we want to intercept the intent…which has the extra theme with the value Punny…as retrieved on line 55.…At the end of this line at dot respond with…which we will need to supply an activity result.…What result.…
Let's define it.…Go back to the beginning of the function…at val result equal…instrumentation.activity result…and it will take two parameters.…First the result code,…activity.result_OK.…The second parameter is a result data intent.…We'll just type Intent here for now…and then go to the line in front and define this intent.…
In the beginning of the function on line 54,…type val intent equal intent.…Inside this intent we want to return the name.…
- 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.