Join Chiu-Ki Chan for an in-depth discussion in this video Refactor: Show error, part of Effective Android Testing for Mobile Developers.
- [Instructor] In step three,…we show an error when the recipe is null.…Look at line 35, though.…We don't know what is recipe anymore…because we're hiding it inside the presenter.…This is fine, because we will move this null check…into the presenter.…Copy line 36 to line 38.…Switch to the presenter.…Inside loadRecipe, in line 15,…we are going to add the null check here.…
If recipe equals null,…we are going to paste in the line that we copied.…And, actually, we don't need the return line,…so we can delete that.…Android Studio is not happy…because it doesn't know what is the titleView…and what is the descriptionView.…This is fair, since they are TextView…and Android-specific, and the presenter doesn't have…a handle on it.…To keep the presenter Java only,…we will need to show error via the view interface.…Open RecipeContract.…
Inside the interface view, in line five,…we will add the new function,…void showRecipeNotFoundError.…Then, we will switch back to the presenter,…and instead of directly manipulating…the title and the view,…
- 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.