Join Chiu-Ki Chan for an in-depth discussion in this video UI-less on-device test: Setup, part of Effective Android Testing for Mobile Developers.
- [Instructor] Great, now we're on our way to read from an asset folder into a recipe store. How do we test it? We cannot use JVN unit test because the recipe store class requires a context to read the assets. We need to use an instrumentation test. Remember, an instrumentation test runs on a device, and, therefore, have access to Android classes. To create an instrumentation test we will add espresso as a dependency.
Go to app slash build.gradle. In the dependency block in line 24 we will add another dependency. This time we will use an Android test dependency, so Android test compile. And then we are going to use com.android.support.test.espresso: espresso-core: 2.2.2.
We are going to actually exclude something from this dependency. Exclude group: com.android.support, module: support-annotations. We add this exclude line for espresso library so that we can avoid version conflict with the support annotations that is included by addcompat in line 23.
Click on sync now to run a gradle sync. With all the dependencies taken care of, let's write the test.
- Why test?
- Local vs. on-device
- Code coverage
- UI testing
- Hermetic environment
- Dependency injection
- Testing with MVP
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 58m Intermediate
Android Studio Essential Trainingwith David Gassner3h 41m Beginner
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m 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.