We have the not uncommon requirement of executing unit tests of our Android application which make use of assets which are only required for unit testing.
With the Eclipse-based SDK this was simple and obvious - the test project was a separate project with its own assets folder. With Android Studio this is meant to be something that one configures in build.gradle (or by convention).
Our unit tests are executing, finally, but I've exhausted every suggestion I've found find regarding a custom (and, ideally, merged) assets folder. Here's what I've tried:
Adding a test closure to sourceSets within the android closure (by closure I mean that which is between the curly braces in build.gradle).
androidTest { assets.srcDirs = ['src/androidTest/assets/'] }
Same thing, but with "test" as the name of the sourceSet (as opposed to "androidTest", above) and also with "instrumentTest".
- Various combinations of above, plus androidTest.setRoot("test"), androidTest.setRoot("androidTest"), both of which cause our unit tests to not be recognized ("empty suite").
This question could be more generically stated as "how does one employ different directories for unit tests in Android Studio".
We've been over the documentation from Android and either we're not understanding it, it's wrong, or there's a bug somewhere.
Any help would be very much appreciated.