This project exists to highlight an issue in Flank v23.10.1, namely that annotations specified in test-targets do not respect parameterized tests. Aside from the additional test classes, this is an unchanged default Android Studio project.
This project includes four test classes, each containing a single test:
Instrumented
test classes are annotated with @RunWith(AndroidJUnit4::class)
, while Parameterized
test classes are annotated with @RunWith(Parameterized::class)
. Methods in the Annotated
classes are marked with the @Annotation annotation.
When running the following command with no test-targets
defined in the flank.yml file:
java -jar flank.jar android run --dump-shards
This results in the following abbreviated android_shards.json file.
"shard-0": [
"class flank.shard.annotationbug.InstrumentedTest#useAppContext"
],
"shard-1": [
"class flank.shard.annotationbug.InstrumentedAnnotatedTest#useAppContext"
],
"shard-2": [
"class flank.shard.annotationbug.ParameterizedTest"
],
"shard-3": [
"class flank.shard.annotationbug.ParameterizedAnnotatedTest"
]
If we now add the following lines to the gcloud
section of the flank.yml
file:
test-targets:
- annotation flank.shard.annotationbug.Annotation
We will then get the following abbreviated android_shards.json
file:
"shard-0": [
"class flank.shard.annotationbug.InstrumentedAnnotatedTest#useAppContext"
]
However, there are two tests that should be included; both the InstrumentedAnnotatedTest
and the ParameterizedAnnotatedTest
should be included in the test shards.