Documentation ¶
Overview ¶
`go test`-like functional testing framework. Can be used with Testify require/assert/mock.
Index ¶
- func Run(ctx context.Context, fn TestFunc, opts ...FunctionalOption) bool
- func RunBenchmarkSuiteTimes(ctx context.Context, suiteName string, times int, tests []BenchmarkFunc, ...) bool
- func RunSuite(ctx context.Context, suiteName string, tests []TestFunc, ...) bool
- func RunWithName(ctx context.Context, name string, fn TestFunc, opts ...FunctionalOption) bool
- type B
- type BenchmarkFunc
- type FunctionalOption
- type T
- func (t *T) Args() []string
- func (t *T) Deadline() (time.Time, error)
- func (t *T) Error(args ...any)
- func (t *T) Errorf(format string, args ...any)
- func (t *T) FailNow()
- func (t *T) Log(message ...any)
- func (t *T) Logf(format string, args ...any)
- func (t *T) Name() string
- func (t *T) Run(name string, fn TestFunc) bool
- func (t *T) Skip(args ...any)
- func (t *T) SkipNow()
- func (t *T) Skipf(format string, args ...any)
- func (t *T) Skipped() bool
- type TestFunc
- type TestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(ctx context.Context, fn TestFunc, opts ...FunctionalOption) bool
Run a test. Test named after function name.
func RunBenchmarkSuiteTimes ¶
func RunBenchmarkSuiteTimes(ctx context.Context, suiteName string, times int, tests []BenchmarkFunc, opts ...FunctionalOption) bool
Run a suite of benchmark tests as a unit. Run each benchmark n times. Generates summary when finished.
func RunSuite ¶
func RunSuite(ctx context.Context, suiteName string, tests []TestFunc, opts ...FunctionalOption) bool
Run a suite of tests as a unit. Generates summary when finished.
func RunWithName ¶
Run a test with user-provided name.
Types ¶
type B ¶
Functional benchmark context.
func (*B) ResetTimer ¶
func (b *B) ResetTimer()
func (*B) Run ¶
func (b *B) Run(name string, fn BenchmarkFunc, opts ...FunctionalOption) TestResult
type FunctionalOption ¶
type FunctionalOption interface {
Apply(t *T)
}
func WithArgs ¶
func WithArgs(args ...string) FunctionalOption
func WithWriter ¶
func WithWriter(writer io.Writer) FunctionalOption
WithWriter sets log output writer.
type TestResult ¶ added in v4.10.0
func RunBenchmarkTimes ¶
func RunBenchmarkTimes(ctx context.Context, fn BenchmarkFunc, times int, opts ...FunctionalOption) TestResult
Run a benchmark test. Test named after function name.
func RunBenchmarkTimesWithName ¶ added in v4.10.0
func RunBenchmarkTimesWithName(ctx context.Context, name string, fn BenchmarkFunc, times int, opts ...FunctionalOption) TestResult
Run a benchmark test with user-provided name.
Click to show internal directories.
Click to hide internal directories.