rules_scala
rules_scala copied to clipboard
Supporting test sharding
This issue is part of a broader proposal to merge some of the features in lucidsoftware/rules_scala into this ruleset.
The tracking issue for this effort
The relevant proposal section.
Bazel has a test sharding feature that test runners can choose to support. From the documentation on test sharding:
Tests can be parallelized via test sharding. See
--test_sharding_strategyandshard_countto enable test sharding. When sharding is enabled, the test runner is launched once per shard. The environment variableTEST_TOTAL_SHARDSis the number of shards, andTEST_SHARD_INDEXis the shard index, beginning at 0. Runners use this information to select which tests to run - for example, using a round-robin strategy. Not all test runners support sharding.
Test sharding imposes a couple benefits:
- It's an easy way to speed up large test targets
- It's helpful in end-to-end testing, where each running test can spin up its own web browser
We rely on test sharding extensively at Lucid Software and would like to implement it in bazelbuild/rules_scala.