Issue
I have an app built with Retorift2 + Dagger2. I started to write Android UI tests using Espresso. To wait for a netwoking calls I need to register an IdlingResource. I have added dependency to OkHttp3IdlingResource.
I need to Inject a OkHttp in my test class, but as AppComponent is not in the same source directory so I can't just add
void inject(RegistrationLoginUiTest activity);
To my component.
How can I get OkHttp from the dependency graph into my test class?
Is the only way to create TestAppComponent and swap it with the AppComponent?
Solution
I have sorted out that in any case if I want to inject test class I should create TestAppComponent where I should add line:
void inject(RegistrationLoginUiTest activity);
And then swap TestAppComponent with AppComponent
Answered By - Vadims Savjolovs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.