flank: Test count and smart sharding count dont match
Describe the bug
A clear and concise description of what the bug is.
Test result shows app module has 349 tests but smart sharding show and calculate with 232.
To Reproduce
Steps to reproduce the behavior:
It happens with out project. i dont have a repo to share.
Expected behavior
A clear and concise description of what you expected to happen.
Test result and smart sharding should have same count.
Details (please complete the following information):
Have you tested on the latest Flank snapshot?
Post the output of
flank --version.
Flank 20.08.1 In the repo, there are Ignored, suppressed and parameterized tests. With no orchectrator
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (19 by maintainers)
tl;dr
Flank does not support parameterized tests sharding. Every class with parameterized is considered as one test during shard calculation.
Flank is using DEX parser to decompile apks and gather info about all the tests inside. As for now, Flank is unable to determine how many times a test in parameterized class is invoked. Due to this fact scans apks for any class with an annotation that contains
JUnitParamsRunnerorParameterized:and consider this class as a single 'test`, which means - ‘put all test from this class into this shard’
Example:
For apk with classes like above Flank will have a list of tests* to shard: (*of course ‘test’ from flank’s perspective)
foo.A#test1, foo.A#test2, foo.A#test3)foo.B)foo.C#test1, foo.C#test2, foo.C#test3)foo.D)So it gives 3 + 1 + 3 + 1 = 8 and let’s say we want to have 2 shards so flank will calculate shards like
foo.A#test1, foo.A#test2, foo.A#test3, foo.B]foo.C#test1, foo.C#test2, foo.C#test3, foo.D]and will print (same numbers are used to print cache hit)
To get outcome Flank uses FTL API which provides results for all the tests, regardless if it’s parameterized or not. So flank creates outcome for all the tests (
A- 3 tests,B- 3 tests,C- 3 tests,D- 4 tests and that all sums up to 13)Conclusions:
@bootstraponline @jan-gogo @Sloox @piotradamczyk5 @adamfilipow92 I’d like to get your opinion
default time for classes makes sense to me, as I expect this might be different compared to individual test methods.
I think if there’s a 0 we should skip it.
I like it
I think we already researched this and determined that parameterized tests can only be run by class?
It might be more accurate to say classes per shard when detecting parameterized tests?
If there are no parameterized tests then it’s true to say we are doing per method sharding. If there are parameterized tests, then we do a hybrid of class sharding + per test sharding.
Here is obfuscated android_shards.json and flank.yml
flank.zip
We probably want a
--default-class-time, which by default can equal the default test time. Then users can independently set default times for parameterized classes vs individual test methods.How about the case when either class count or test count equals 0? Do we want to print it that way:
or should we skip it? Or skip it only for the class count?
Flank knows exactly how many tests and classes are being sent to firebase test lab, maybe we could do something like this:
And what is actually bizarre is we should have 542 tests 😄