Learn how to create Instrumented unit tests.
- [Voiceover] In the last chapter,…you saw how to create local tests.…That is unit tests that don't exercise any…of the Android API.…And don't require to be run…on any Android device or emulator.…In this chapter, you learn about creating…and exercising instrumented tests.…Instrumented tests are unit tests…that can utilize the Android API.…Can access the resources of the device,…and do require an Android device or emulator to run.…Instrumented tests are exercised by the Android JUnitRunner.…
Instrumented tests are readily identifiable.…The test class is annotated with RunWith annotation.…Using an Android JUnit4 as a parameter.…When building local test classes,…I could of added RunWith annotation to the test class.…As shown in the code example on the right.…In that case, I would of specified JUnit4.class…as my runner.…RunWith allows me to explicitly define…the runner use to execute my unit tests.…By default, JUnit4, the JUnit4 runner…is used to execute tests.…
So the RunWith annotation is superfluous.…That's why you didn't see it in the last chapter.…
AuthorJames P White
- Why unit test?
- Unit testing tools
- Local testing with JUnit
- Working with JUnit assertions, rules, and categories
- Executing instrumented tests
- Filtering tests
- Testing with UI Automator and other testing tools
Skill Level Intermediate
Foundations of UX: Usability Testingwith Chris Nodder1h 29m Beginner
1. Getting Started
2. Local Tests
3. Instrumented Tests
4. Other Android SDK Testing Tools
5. Mocking objects
- 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.