Standard library / testing

testing.T.Parallel()

Allow a test to run with other parallel tests; avoid shared process-global mutations. Expected stdout: 'parallel test\nPASS\n'. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (t *T) Parallel()

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func TestReference(t *testing.T) { t.Parallel(); fmt.Println("parallel test") }
Go Reference