Why do you put Robolectric tests (data-test) in a different module?
Why did you just created the /src/test/java inside :data?
Because it is the only way to set it up. If you check the module, is a pure java module and not an android one.
@android10, is it a specific problem with an Android Library Project? I'm planning to implement Unit Tests + Espresso in my presentation layer. Will I need to create a 'presentation-test' module? I'll try to use /src/test/java inside :presentation first. If it works, you'll comment here.
This was due to the robolectric 2+ setup that needed some hacks in order to make it work. There was not any unit test support back then.
Understood. So, in the current version of Robolectric and Android Studio, it'd be possible, right?
Anyway, I'm still using separate modules for the data and presentation because of this issue:
https://bitbucket.org/hvisser/android-apt/issues/22/dagger-robolectric-gradle-apt-source-not
I like to use Dagger to inject my tests and the Android APT isn't generating source for 'test' source. With separate module, I'm using the plugin the gradle-apt-plugin, wich makes the Dagger to work nicely with tests.
@fernandocamargoti all data unit tests put inside src/test. No need to use a separate module now. Here is the changeset: https://github.com/android10/Android-CleanArchitecture/commit/317dd33f93fd1fd92378474d6a530c328628ce3d
It's nice, @android10. I'll migrate as soon as that Android APT's bug is fixed, since I'm using Dagger to inject my tests.
@android10 Why presenter tests are not written using robolectric to avoid need to virtual device?
@dharmendrainnovify if there are no android dependencies, there is no need to use Robolectric.