Skip to content

Frequent 'No tests found' when sharding tests #973

Open
@chrisbanes

Description

@chrisbanes

Description

When sharding tests I get frequent (and seemingly random) 'No tests found' errors which fail the build.

See this PR: google/accompanist#463 for an example.

Steps to Reproduce

I'm not 100% sure what the repro is. Having a small number of tests in the module seems to be the trigger.

I think this is because the library is relying on hashCode being uniformly random over a small data-set, which isn't the case. If the module only has ~5 tests, and I'm sharding over 3 runs, the chance of at least 1 shard having 0 tests is quite high.

Expected Results

Shards with no tests from a module don't fail the build.

Actual Results

com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[test(AVD) - 5.1.1] FAILED 
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).

AndroidX Test and Android OS Versions

1.3.0

Link to a public git repo demonstrating the problem:

google/accompanist#463

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions