Standard library / testing

testing.T.Name()

Return the full test name, including parent names. Expected stdout: 'TestReference\nPASS\n'. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (c *T) Name() string

Return Value

string

Result of the operation described above.

Working Example

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