Now that Google has added experimental unit test support, how might one go about sharing resources across both unit tests and instrumentation test?
For example, say I have a TestUtils.java
class that I want accessible in both my unit tests and my instrumentation tests. If I put it in my src/test/java
folder, it will be accessible to my unit tests. If I put it in my src/androidTest/java
folder, it will be accessible to my instrumentation tests. How do I make it accessible to both?
The only solution I see right now is putting it in src/debug/java
, but is there a better way?
android {
sourceSets {
String sharedTestDir = 'src/sharedTest/java'
test {
java.srcDir sharedTestDir
}
androidTest {
java.srcDir sharedTestDir
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With