Discover how to exercise services with ServiceTestRule, and how to create and use custom service test rules.
- [Voiceover] The Android Testing Support Library…supports testing background services with another rule.…Namely, a ServiceTestRule.…Like ActivityTestRule,…there's a built in ServiceTestRule…that you can use with the rule annotation…in your instrumented test to create an instance of a service…for your test method.…You can also extend and customize a ServiceTestRule…if you want to set up and clean up…the Android environment and the service itself…before and after you had tested the service.…
Before we can begin to understand…ServiceTestRules, I need to add a simple…Android service that we can use to explore the rules.…One critical note before creating MyService,…ServiceTestRule supports testing regular…Android services, but not IntentServices.…If you are unfamiliar with the difference…between a regular service and an IntentService,…check out this resource, it provides…a nice little synopsis.…I started Android Studio and opened…project 03_04_start in order to…explore ServiceTestRule.…
I create a new service by selecting…
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.