For Android Espresso Testing, i'm using the following commands to run our tests:
./gradlew pixel4api30DebugAndroidTest
-Pandroid.testInstrumentationRunnerArguments.class=com.aaa.bbb.ccc.Suites.TestSuite
-Pandroid.experimental.androidTest.numManagedDeviceShards=2
This splits all the tests in the TestSuites across 2 pixel 4 emulators.
If I have the following in the TestSuite:
TestClass1
- Test1
- Test2
- Test3
TestClass2
- Test1
- Test2
- Test3
It may run TestClass1.Test1 on 1 emulator and TestClass1.Test2 on emulator 2. (it could pick any emulator to run any of the tests on).
Is there a way to force it to split the shards by TestClasses? So it will run TestClass1 and all tests on one emulator, TestClass2 and all tests on an emulator.
I believe if you have used Spoon in the past, you may have been able to accomplish this by using singleInstrumentationCall property as noted here: https://github.com/jaredsburrows/gradle-spoon-plugin