Documentation
¶
Index ¶
- func Assert(t TestInfo, message string, actual interface{}, ...)
- func NewCommand(name string, description string, version string, stash GenerateStash) *cobra.Command
- func RegisterTest(t Test)
- func Step(t TestInfo, name string, step func() error)
- type Cleanup
- type GenerateStash
- type SetupFunction
- type SetupSuiteFunction
- type Suite
- type SuiteInfo
- type TearDownFunction
- type Test
- type TestFunction
- type TestInfo
- func (t TestInfo) Iteration() int
- func (t TestInfo) SetupInfo() interface{}
- func (t TestInfo) Stash() interface{}
- func (t TestInfo) SuiteSetupInfo() interface{}
- func (t TestInfo) TestID() string
- func (t TestInfo) TimeSinceLastStep() string
- func (t TestInfo) Timeout() time.Duration
- func (t TestInfo) Write(p []byte) (n int, err error)
- func (t TestInfo) WriteHeader(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(t TestInfo, message string, actual interface{}, f func(interface{}, ...interface{}) string, expected ...interface{})
Assert can use goconvey function to perform an assertion.
func NewCommand ¶
func NewCommand( name string, description string, version string, stash GenerateStash, ) *cobra.Command
NewCommand generates a new CLI
Types ¶
type GenerateStash ¶
GenerateStash is a type of function that returns a generated stash.
type SetupFunction ¶
type SetupFunction func(context.Context, TestInfo) (interface{}, TearDownFunction, error)
SetupFunction is the type of function that can be run a a test setup. The returned data will be available to the main test function using TestInfo.SetupInfo() function. The returned function will be run at the end of the test.
If SetupFunction returns an error, the entire suite of test is stopped.
type SetupSuiteFunction ¶
type SetupSuiteFunction func(context.Context, SuiteInfo) (interface{}, TearDownFunction, error)
SetupSuiteFunction is the type of function that can be run from a suite setup. The returned data will be available to the main test function using TestInfo.SuiteSetupInfo() function. The returned function will be run at the end of the suite.
If SetupSuiteFunction returns an error, the entire suite of test is stopped.
type Suite ¶
type Suite struct { Name string Description string Setup SetupSuiteFunction }
Suite is a collection of tests
type SuiteInfo ¶
type SuiteInfo interface { // Register a test into a suite RegisterTest(t Test) // Write performs a write Write(p []byte) (n int, err error) }
SuiteInfo is the interface for the test writer
type TearDownFunction ¶
type TearDownFunction func()
A TearDownFunction is the type of function returned by a SetupFunction or SetupSuiteFunction.
type Test ¶
type Test struct { Name string Description string Author string Tags []string Setup SetupFunction Function TestFunction SuiteName string // contains filtered or unexported fields }
A Test represents an actual test.
type TestFunction ¶
A TestFunction is the type of a function that is run by a Test.
type TestInfo ¶
type TestInfo struct {
// contains filtered or unexported fields
}
A TestInfo contains various information about a test.
func (TestInfo) SetupInfo ¶
func (t TestInfo) SetupInfo() interface{}
SetupInfo returns the eventual object stored by the Setup function.
func (TestInfo) Stash ¶
func (t TestInfo) Stash() interface{}
Stash provides the callers data that may store configs/runtime they need
func (TestInfo) SuiteSetupInfo ¶
func (t TestInfo) SuiteSetupInfo() interface{}
SuiteSetupInfo returns the eventual object stored by the Suite Setup function.
func (TestInfo) TimeSinceLastStep ¶
TimeSinceLastStep provides the time since last step or assertion