Dependency Injection with Dagger 2
Espresso tests and Dagger: Adding the TestApplicationComponent
Up next
Previous
About
In this lesson we create an internal testing module along with the TestApplicationComponent. This is a test Component that will extend our ApplicationComponent. We can use this to provide different implementations of dependencies in UI tests.
Instructor
Links
Comments
Hi,
At about 1:40 you are talking about doubling down on some code debt. I understand the term code debt. But can you explain the part about we should have moved appcomponent. Is there something we should have done different or if there is a potential issue? And following on in this tutorial is this the best way to do this? Thanks
Hi Steve,
I was referring to the appcompat
dependency, where we have the version explicitly inline, rather than having the version be defined in the project level build.gradle
file, where we have other common dependencies/versions defined. In short, there should be a value for appcompat
here: https://github.com/bgogetap/GitHubBrowser-Dagger-Sample/blob/29-espresso-test-application-component/build.gradle#L41
Rewatching the part you reference, I can get the confusion as I was actually referring to a dependency a few lines down from where the cursor was--sorry about that.
Ideally, there should be no explicit com.dep:dep-artifact:dep.version
in module build.gradle
files. Instead, having Deps.artifact
, which is defined in the project level build.gradle
file, makes for easier maintenance of the project and dependency versions as time goes on.
Lessons in Dependency Injection with Dagger 2






















































