Looking for working example of Sharding?
I am trying to use sharding with the new AndroidJUnitRunner, using the sample in testrunner/AndroidJunitRunnerSample in this repo.
$./gradlew installDebug installDebugAndroidTest
# normal instrumentation
$ adb shell am instrument -w com.example.android.testing.androidjunitrunnersample.test/android.support.test.runner.AndroidJUnitRunner
# sharding
$ adb shell am instrument -w -e numShards 5 -e shardIndex 1 com.example.android.testing.androidjunitrunnersample.test/android.support.test.runner.AndroidJUnitRunner
However, the number of test run in both are 69 for me... Is there something I missed?
P.S. If I use $ adb shell am instrument -w -e numShards 5 -e shardIndex 10 it still runs all 69 tests without complaining. If I use $ adb shell am instrument -w -e numShards 5 -e shardIndex A it will actually throw NumberFormatException correctly, so I am sure the parameters are correctly being processed...
Looks like a bug. I'll add a task and we will look into it. I keep this issue open to track progress on this.
This was now fixed internally and will go out with the next release...
Thanks!