core

package
v0.0.0-...-37536b8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: BSD-2-Clause Imports: 6 Imported by: 2

Documentation

Overview

Package core provides a minimal core for organizing, executing and reporting of test cases nested in test groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the "C" of MVC (Model View Controller). In a test framework, all the test cases form a model (but unchangable by the controller), the test reporter is the view, and the controller controls the test running and send the test result to the test reporter.

func NewController

func NewController(reporters ...ext.Reporter) *Controller

NewController creates and intialize a new Controller using r as the test reporter.

func (Controller) End

func (b Controller) End(group *ext.TestGroup)

func (Controller) Progress

func (b Controller) Progress(g *ext.TestGroup, stats *ext.Stats)

func (*Controller) Start

func (c *Controller) Start(path Path, concurrent bool, funcs ...TestFunc) error

Start starts tests defined in funcs concurrently or sequentially.

type DescFunc

type DescFunc func(description string, f func())

DescFunc is the type of the function to define a test group with a descritpion and a closure.

type Path

type Path []Serial

Path represents a path from the root to the leaf of nested test groups.

func (*Path) Set

func (p *Path) Set(s string) (err error)

Set implements the Set method of flag.Value interface.

func (Path) String

func (p Path) String() string

Set implements the String method of flag.Value interface.

type S

type S interface {
	Alias(name string) DescFunc // Define an alias of a DescFunc.
	Fail(err error)             // Report a failure and continue test execution.
	FailNow(err error)          // Report a failure and stop test execution immediately.
	// contains filtered or unexported methods
}

S (short for "spec") provides the interface for writing tests and internally holds an object that contains minimal context needed to pass into a testing goroutine.

type Serial

type Serial int

Serial is an integer serial number of the execution of a test closure.

func (Serial) String

func (s Serial) String() string

String converts a Serial to a string.

type TestFunc

type TestFunc func(S)

TestFunc is the type of the function prepared to run in a goroutine for each test case.

Jump to

Keyboard shortcuts

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