Documentation
¶
Overview ¶
Package parallel provides plugin to mark tests as parallel by default.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithScope ¶ added in v1.1.0
func WithScope(scope Scope) testoplugin.Option
WithScope sets a Scope of a plugin. Scope defines to what extent tests should become parallel.
This plugin, by default, marks as parallel only suites' tests. You may want to extend its reach to suites as a whole, so that, say, multiple runs to testo.RunSuite will also run in parallel.
parallel.WithScope(parallel.SuiteTests | parallel.Suites)
It's also possible to mark "native" tests as parallel by adding a Tests scope.
parallel.WithScope(parallel.SuiteTests | parallel.Suites | parallel.Tests)
func WithSync ¶
func WithSync() testoplugin.Option
WithSync signals that this test is to be run in sync with (and only with) other sync tests.
Types ¶
type PluginParallel ¶
PluginParallel marks all tests as parallel by default.
func (*PluginParallel) Plugin ¶
func (p *PluginParallel) Plugin( _ testoplugin.Plugin, options ...testoplugin.Option, ) testoplugin.Spec
Plugin implements testoplugin.Plugin.
type Scope ¶ added in v1.1.0
type Scope uint8
Scope defines to what extent tests should become parallel.
const ( // SuiteTests is a [Scope] that covers suite tests. // // For example: // // func (Suite) TestA(t T) { ... } // func (Suite) TestB(t T) { ... } // // Tests A & B will be marked as parallel. // // This is a default value. SuiteTests Scope = 1 << iota // Suites is a [Scope] that covers suites but not their tests. // // For example: // // func Test(t *testing.T) { // testo.RunSuite(t, new(Suite)) // testo.RunSuite(t, new(OtherSuite)) // } // // Both of these suites will be run in parallel. Suites // Tests is a [Scope] that covers native tests. // // For example: // // func TestA(t *testing.T) { // testo.RunSuite(t, new(Suite)) // } // // func TestA(t *testing.T) { // testo.RunSuite(t, new(OtherSuite)) // } // // Tests A & B will be run in parallel. Tests )
Available scopes. Scopes can be combined using bitmasks:
const All = SuiteTests | Suites | Tests