Join Chiu-Ki Chan for an in-depth discussion in this video Clear favorites, part of Effective Android Testing for Mobile Developers.
- [Instructor] RecipeActivityTest has a before function,…that clears the favorites.…We can move this logic to RecipeRobot,…by Moving the Favorites there,…and then Clearing it in the Constructor.…Cut the lines from 35 to 41.…In other words, the whole clearFavorites function.…Go to RecipeRobot, and Paste it in.…We will Remove the word Before in line 14,…and we'll Change it Into a Constructor…by Deleting the word Void,…and then Renaming it to ReciptRobot.…
Inside the function,…favorites is not declared.…So put your Mouse over Line 17 on the word Favorites,…Press Alt + Enter, and Create Field.…The default is private final InMemoryFavorites,…which is fine.…Next, go back to RecipeActivityTest, Scroll Down.…In the function alreadyFavorite, in Line 56,…you can see that we call the function Put on favorites.…
However, we are actually going to be using the favorites…inside the robot itself.…So what we need to do,…is to Delete this from the Test itself,…and Move the Function into the Robot.…Copy the Line 56,…go to RecipeRobot,…
- Why test?
- Local vs. on-device
- Code coverage
- UI testing
- Hermetic environment
- Dependency injection
- Testing with MVP
Skill Level Intermediate
1. Testing Considerations
2. Test as You Go
3. UI Testing
4. Hermetic Environment
5. Robot Pattern
- 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.