- We want our tests to be repeatable,…meaning that every time we run them,…we want the same results…as long as the app did not change.…To do that we need to make…our test environment hermetic.…A hermetic environment is sealed from external dependencies.…The best way to understand that is to go through an example.…I have prepared the project in exercise files.…Download it, and import it into Android Studio.…
It doesn't matter where you put your project.…I put mine under projects, hermetic.…If Android Studio asks you to upgrade Gradle,…click, Do not remind me again.…Press Command + O to open MainActivity.…Here in onCreate on line 13, we can see that…we figure out what is the time now…by instantiating DateTime.…
Then on line 15, depending on the time of the day,…we greet the user with either, Good morning,…Good afternoon, Good evening, or Good night.…This is not hermetic because it has an external dependency,…namely, the time of the day.…Imagine writing a test for this app.…What should greeting view say?…If we write the test in the afternoon,…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
2. Hermetic Test Environment
- 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.