Join Chiu-Ki Chan for an in-depth discussion in this video RecipeActivityTest: An espresso test, part of Effective Android Testing for Mobile Developers.
- [Instructor] So far, we have been…adding functionalities to our app.…Let's write some tests to make sure…that it is behaving as expected.…We will be using the Espresso library,…which we already included as a dependency…when we wrote our instrumentation unit test.…At that point, we only used Espresso…to get access to the context.…Espresso also lets us simulate user actions,…such as typing and clicking,…and also verify the state of the UI.…
We will create an Espresso test for recipe activity.…Scroll up, and point your cursor to recipe activity.…Press command shift T to create a new test.…Press okay, and then select the folder Android Test,…because we want to run it on an android device.…The first thing we need is a test rule.…At rule, and then public, activity test rule.…
After, type recipe activity.…We will call this variable activity rule.…Initialize it by calling new activity test rule,…delete the type, because we don't need it.…We will need to give it three parameters.…The first one is the class of activity we want to use.…
- 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 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.