testing

package
v6.0.0-rc2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 5 Imported by: 889

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullDriver = &nullDriver{}

NullDriver does nothing, ignores all output and doesn't die on errors

Functions

This section is empty.

Types

type ConsoleDriver

type ConsoleDriver struct {
	Stdout io.Writer
	// contains filtered or unexported fields
}

ConsoleDriver outputs test result to the given stdout/stderr descriptors

func NewConsoleDriver

func NewConsoleDriver(stdout io.Writer) *ConsoleDriver

NewConsoleDriver initializes and returns a new console driver with output to given file

func NewConsoleDriverWithKiller

func NewConsoleDriverWithKiller(stdout io.Writer, killer func()) *ConsoleDriver

NewConsoleDriverWithKiller initializes and returns a new console driver with output file Killer function will be called on fatal errors

func (*ConsoleDriver) Error

func (d *ConsoleDriver) Error(field string, err error)

func (*ConsoleDriver) Fatal

func (d *ConsoleDriver) Fatal(field string, err error)

func (*ConsoleDriver) Info

func (d *ConsoleDriver) Info(field, value string)

func (*ConsoleDriver) Result

func (d *ConsoleDriver) Result(data string)

func (*ConsoleDriver) Run

func (d *ConsoleDriver) Run(name string, f func(Driver))

func (*ConsoleDriver) Warn

func (d *ConsoleDriver) Warn(field, reason string)

type Driver

type Driver interface {
	// Run tests under a given namespace
	Run(name string, f func(Driver))

	// Info reports some value retrieved while testing to the user
	Info(field, value string)

	// Warn shows a warning to the user
	Warn(field string, reason string)

	// Error will report an error on the given field if err != nil, will report OK if not
	Error(field string, err error)

	// Fatal behaves like error but stops current goroutine on error
	Fatal(field string, err error)

	// Shows given result to the user
	Result(data string)
}

Driver for testing, manages test flow and controls output

type Testable

type Testable interface {
	Test(Driver)
}

Testable is optionally implemented by clients that support self testing. Test method will test current settings work for this output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL