I would like to separate my integration tests from my unit tests on Android Studio using gradle.
Today, androidTest (expresso) and test (unit test) folders are created by default when you start an Android project.
Using gradle, I want to tell gradle build system and Android Studio that an onther folder (integTest) contains some tests (JUnit).
I've followed this article here, but I can't make it work. The first part - setting up the source test and the task - seems to be ok, but the second part isn't :
dependencies {
// ...
integTestCompile sourceSets.main.output
integTestCompile configurations.testCompile
integTestCompile sourceSets.test.output
integTestRuntime configurations.testRuntime
// ...
}
This is causing some errors :
Error:(139, 0) Could not get unknown property 'main' for SourceSet
container of type
org.gradle.api.internal.tasks.DefaultSourceSetContainer.
If I don't includes those lines, gradle is happy but the integTest folder is not recognize as a test folder (green color).
I also tried to manually set the integTest folder as a test resource (cmd + shift + a --> Mark Directory As.. Test Folder). With this manual step, I can run the tests but I keep getting the same error : empty test suite.
Is anyone manage to make that work ?
Thanks.