For our User Interface tests, we need to provide mock instance of our interfaces and classes so that we can mock the responses returned by them. In this lesson, we're going to be setting up the test application with it's own Dependency Injection graph so that we have control over these instances that are returned for mocking.
I cannot get the DaggerTestApplicationComponent class to resolve. I can get DaggerApplicationComponent, but not DaggerTestApplicationComponent. I've already tried rebuilding the project, and adding:
generateStubs = true
to the build.gradle file (in android). I should note that in your code I get the same error. It too will not find the reference.
Okay, I figured this out. You need to run the :Mobile_ui:assembleAndroidTest gradle script to get Dagger to create test stub classes.
I am unable to import TestApplicationComponent class into the module as well as DaggerTestApplicationComponent, please help .
Hi Udit, this means that the test DI code hasn't been generated correctly. You shouldn't need to, but have you tried building the project or running :Mobile_ui:assembleAndroidTest beforehand?