Join James P White for an in-depth discussion in this video Adding local tests and failure, part of Android App Development: Unit Testing.
- [Voiceover] Let's explore how to add and exercise…new test classes to your project.…I've started Android Studio again,…and opened up project 02_04_start.…Local tests of your app should be created…under the folder labeled test.…Using the project view,…we can see the layout of the project files,…and see where example unit tests,…that it the default local test created by Android Studio…false.…This is the app source test folder in the file system.…You can and often will have subpackages,…but all your local tests,…and their owning packages…should be found in the app source test folder.…
To create a new test class,…I simply create a new class in this app source test folder.…However, I can take a shortcut.…Returning to the android view,…I can simply request to create a new test class…in the test package.…In this case I'm going to create a new test…called my test.…Allow me to add a simple unit test method,…to the new test class.…Note how Android Studio…indicates there's an error in my code…when I use assertEquals.…
It requires that I add…
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
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.