Android-CleanArchitecture icon indicating copy to clipboard operation
Android-CleanArchitecture copied to clipboard

How to test your views?

Open nat-e opened this issue 11 years ago • 1 comments

I didn't see any unit tests for the Fragments. How do you inject a mockPresenter into your fragment to test it?

nat-e avatar Aug 07 '15 21:08 nat-e

Because I'm not interested in testing views, specially because tests are code to maintain, and what solves really my problem is both domain and logic layer.

In any case, this is a matters of taste and personal opinion, if you want to do it, just create a constructor in the fragment that satisfies all dependencies, then you can instantiate as any other class or override de module using dagger and inject mock objects instead of real implementations of your collaborators.

android10 avatar Aug 10 '15 21:08 android10