Documentation ¶
Index ¶
- Variables
- func FuncName(fn interface{}, suffixed bool) string
- func InternalRunSubTests(ctx context.Context, t *T)
- func NewHook(order int, setupFunc SetupFunc, teardownFunc TeardownFunc) *orderedHook
- func NewSetupHook(order int, setupFunc SetupFunc) *orderedHook
- func NewTeardownHook(order int, teardownFunc TeardownFunc) *orderedHook
- func RunTest(ctx context.Context, t *testing.T, opts ...Options)
- type GomegaSubTestFunc
- type Hook
- type InternalRunner
- type Options
- func AnonymousSubTest(st SubTestFunc) Options
- func GomegaSubTest(st GomegaSubTestFunc, name ...string) Options
- func Hooks(hooks ...Hook) Options
- func Setup(fn SetupFunc) Options
- func SubTest(subtest SubTestFunc, name string) Options
- func SubTestSetup(fn SetupFunc) Options
- func SubTestTeardown(fn TeardownFunc) Options
- func Teardown(fn TeardownFunc) Options
- func WithInternalRunner(runner InternalRunner) Options
- func WithOptions(opts ...Options) Options
- type SetupFunc
- type SubTestFunc
- type SubTestOrderedMap
- type T
- type TeardownFunc
Constants ¶
This section is empty.
Variables ¶
var ( // InternalOptions is internal variable, exported for cross-package access // InternalOptions holds common setup/teardown hooks of all tests in same package. // testsuite package has options to set this list // Note, when executing all tests, golang run tests on per-package basis InternalOptions = make([]Options, 0) )
Functions ¶
func FuncName ¶
FuncName returns a name that could potentially used as sub test name function panic if given fn is not func
func InternalRunSubTests ¶
InternalRunSubTests is an internal function. exported for cross-package reference
func NewHook ¶
func NewHook(order int, setupFunc SetupFunc, teardownFunc TeardownFunc) *orderedHook
func NewSetupHook ¶
func NewTeardownHook ¶
func NewTeardownHook(order int, teardownFunc TeardownFunc) *orderedHook
Types ¶
type GomegaSubTestFunc ¶
GomegaSubTestFunc is the function signature for sub-test that taking a context and gomega.WithT, and can be registered as SubTest Options
type Hook ¶
type Hook interface { Setup(ctx context.Context, t *testing.T) (context.Context, error) Teardown(ctx context.Context, t *testing.T) error }
Hook is registered for tests and sub tests, should provide SetupFunc or TeardownFunc (or both) This interface is mostly internal usage. Test implementers typically use Options to create instance of this interface
type InternalRunner ¶
InternalRunner is an internal type, exported for cross-package reference
type Options ¶
type Options func(opt *T)
Options are test config functions to pass into RunTest
func AnonymousSubTest ¶
func AnonymousSubTest(st SubTestFunc) Options
AnonymousSubTest is an Options that run a SubTestFunc as generated name
func GomegaSubTest ¶
func GomegaSubTest(st GomegaSubTestFunc, name ...string) Options
GomegaSubTest is an Options that run a GomegaSubTestFunc as given name. If name is not given, a generated name is used Note: when name is given as multiple arguments, the first element is used as format and the rest is used as args:
fmt.Sprintf(name[0], name[1:])
func Hooks ¶
Hooks is an Options that register multiple Hook. Test implementers are recommended to use Setup or Teardown instead
func SubTest ¶
func SubTest(subtest SubTestFunc, name string) Options
SubTest is an Options that run a SubTestFunc as given name
func SubTestSetup ¶
SubTestSetup is an Options that register a SetupFunc to run before each sub test
func SubTestTeardown ¶
func SubTestTeardown(fn TeardownFunc) Options
SubTestTeardown is an Options that register a TeardownFunc to run after each sub test
func Teardown ¶
func Teardown(fn TeardownFunc) Options
Teardown is an Options that register the TeardownFunc to run after ALL sub tests finishs
func WithInternalRunner ¶
func WithInternalRunner(runner InternalRunner) Options
WithInternalRunner is internal option, exported for cross-platform access
func WithOptions ¶
WithOptions group multiple options into one. This is mostly used by other testing utilities to provide grouped test configs
type SubTestFunc ¶
SubTestFunc is the function signature for sub-test that taking a context and can be registered as SubTest Options
func SubTestFuncWithGomega ¶
func SubTestFuncWithGomega(st GomegaSubTestFunc) SubTestFunc
SubTestFuncWithGomega convert a GomegaSubTestFunc to SubTestFunc
type SubTestOrderedMap ¶
type SubTestOrderedMap struct {
// contains filtered or unexported fields
}
SubTestOrderedMap adopted from https://github.com/elliotchance/orderedmap/blob/master/orderedmap.go with reduced functionality
func NewSubTestOrderedMap ¶
func NewSubTestOrderedMap() *SubTestOrderedMap
func (*SubTestOrderedMap) Delete ¶
func (m *SubTestOrderedMap) Delete(key string) (didDelete bool)
Delete will remove a name from the map. It will return true if the name was removed (the name did exist).
func (*SubTestOrderedMap) Get ¶
func (m *SubTestOrderedMap) Get(key string) (SubTestFunc, bool)
func (*SubTestOrderedMap) Keys ¶
func (m *SubTestOrderedMap) Keys() (keys []string)
func (*SubTestOrderedMap) Len ¶
func (m *SubTestOrderedMap) Len() int
func (*SubTestOrderedMap) Set ¶
func (m *SubTestOrderedMap) Set(name string, fn SubTestFunc) bool
Directories ¶
Path | Synopsis |
---|---|
Package consultest Leveraging ittest package and HTTP VCR to record and replay consul operations
|
Package consultest Leveraging ittest package and HTTP VCR to record and replay consul operations |
authmock
Package mock_security is a generated GoMock package.
|
Package mock_security is a generated GoMock package. |
internal
Package internal is an internal package that help to test generated mocks
|
Package internal is an internal package that help to test generated mocks |
redismock
Package redismock is a generated GoMock package.
|
Package redismock is a generated GoMock package. |
sessionmock
Package mock_session is a generated GoMock package.
|
Package mock_session is a generated GoMock package. |
Package sdtest test utilities to mock service discovery client
|
Package sdtest test utilities to mock service discovery client |
golden
Package golden will contain some utility functions for golden file testing
|
Package golden will contain some utility functions for golden file testing |