Currently, I have a test/src/java
folder where all the tests for the Android application are stored (tests are performed using junit, mockito and robolectric).
And I can run those using ./gradlew test
I would like to get two folders:
integrationTest/src/java
- for integration teststest/src/java
- for unit tests
And also I would like to run them separately, for example ./gradlew test
and ./gradlew integrationTest
.
I was able to split test directories using sourceSets
as follows:
sourceSets { test { java { srcDirs = ['src/test/java', 'src/integrationTest/java', 'src/commonTest/java'] } resources { srcDirs = ['src/test/resources', 'src/integrationTest/resources', 'src/commonTest/resources'] } } }
And I had many examples of how to create custom test tasks, but most of them are related to Java, not Android, and others are outdated. I spent the whole day on this, and therefore, if someone can help me, I would really appreciate it.
source share