-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
Support for table-driven tests and benchmarks could be improved by allowing subtests and subbenchmarks to be spawned programmatically by allowing, for example, a Run method on T and B in the testing package. This would enable various use cases, such as:
- an easy way to single out tests and benchmarks in a table from the command line (e.g. for debugging),
- simplify writing a collection of similar benchmarks,
- use of Fatal in sub tests without halting sibling subtests,
- eliminate need to prefix each error message in a test with its subtest name, resulting in more consistent and simpler to write error messages,
- creating subtests from an external/dynamic table source,
- more control over scope of setup and teardown (more than TestMain allows now), and
- more control over parallelism.
Semantically, subtests and subbenchmarks would behave exactly the same as the current top-level counterparts. In fact, the top-level counterparts could be implemented as subtests/benchmarks of a single root. Details would need to be worked out in a design doc.