Friday, June 9, 2017

Dagger Subcomponent MVP Testing


I currently have a project set up in pretty standard MVP fashion. An activity contains several fragments, each of which has their own MVP setup. The Activity has its own Subcomponent whose parent is the application component, and the Fragments are a Subcomponent of the Activity component. Each has their own scope and is able to inject their presenters into themselves beautifully. The problem is testing... I'm struggling to figure out how to get Dagger to return mocked versions of my presenters for UI testing purposes. I currently have a "MockAppComponent" that I replace in my test suite to return mocks / fakes of Application level injections. However, it doesn't appear to be simple to replace subcomponents with mocked versions. Hopefully this scenario makes sense, and I'm hoping someone has come across this at some point in their dev process. Any insight would be awesome! Thanks! via /r/androiddev http://ift.tt/2t3nbwf

No comments:

Post a Comment

Popular Posts