Join Chiu-Ki Chan for an in-depth discussion in this video Refactor: Toggle favorite, part of Effective Android Testing for Mobile Developers.
- [Instructor] Step five reacts to a user event.…In other words, it goes from the view…to the presenter.…We will do that in the listener interface…and have the presenter implement the listener interface.…Go to the presenter and go to line 10.…Add implements RecipeContract.Listener.…Now, let's go to RecipeActivity.…Here in step five in line 43…we have a ClickListener.…
Inside we try to toggle the favorite states…of our recipe but remember,…we have hidden the recipe inside the presenter…so we cannot do it directly here.…What to do?…What we can do is we can add a function to the presenter…to toggle the favorite.…At line 46,…we will do presenter.toggleFavorite…and then we will press alt enter…to create this method.…
We are going to create that inside the RecipePresenter.…In toggleFavorites what we are going to do…is copy and paste the thing from the RecipeActivity.…Go to RecipeActivity,…and then we are going to actually cut out lines 47…and 48, switch to the presenter.…Inside the toggleFavorite function…in line 44 paste it in.…
- 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.