Common test attributes
Size
Thesize attribute is an architectural hint. It affects both the default timeout and the amount of system resources Bazel allocates when scheduling the test.
Common size values include:
Timeout
You could specify an explicittimeout value, either in addition to or instead of size.
Filtering tests
Thesize attribute is useful for filtering. For example, you can use --test_size_filters=small to ask Bazel to run a unit test.
You can also filter with these flags:
Filter by tags
This command runs only tests tagged withsmoke.
Filter by timeout
This command will skip running tests that take a long time.By default, the eternal timeout corresponds to approximately 15 minutes. For
details on timeout values and behavior, see the Bazel Test
Encyclopedia.
Filter by language
This command runs only js_test and go_test targets.Well-known tags
You can add these to thetags attribute of a test to change the way Bazel runs it.
external- the test is intentionally non-hermetic, as it tests something aside from its declared inputs. Forces the test to be unconditionally executed, regardless of the value of--cache_test_results, so the result is not cached.exclusive- the test is not isolated and can interact with other tests running at the same time. Exclusive tests are executed in serial fashion after all build activity and non-exclusive tests have been completed. They can’t be run remotely, either.manual- essentially “skip” or “disabled”. It means a target wildcard pattern, like:allor//...won’t include this target. You can still run it by listing the target explicitly.requires-network- declare that the test should run in a sandbox that allows network access.flaky- run it up to three times when it fails. We’ll learn more about flakiness in a later lesson.
The Aspect CLI provides a handy way to find these:
bazel help tags
