Join Chiu-Ki Chan for an in-depth discussion in this video Dagger TestComponent, part of Advanced Android Espresso Testing.
- [Instructor] Let's create a test component for testing.…Click on the package name under androidTest,…right click, New, Kotlin File/Class.…Call it TestComponent.…We will define an interface here.…The interface test component will…extend ApplicationComponent.…This is because we want the test component to be able…to inject fills into main activity.…
We need to annotate it with component…so that dagger knows that this is a dagger component.…Inside, we are going to define a builder.…Interface builder.…And then we will need to annotate this builder…with the dagger annotation at component dot builder.…On line seven type @Component.Builder.…
To make a builder, we will need a build function.…On line nine, type fun build which returns a test component.…We are asking dagger to generate a builder for us.…In the builder, we would like to be able to provide a clock.…To do that, we will use the binds instance annotation.…@BindsInstance and then fun clock with the parameter clock,…I've typed clock which returns a builder.…
We are asking it to return builder…
- 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.