Documentation
¶
Index ¶
- func Run[T any, G any](testingT *testing.T)
- type AfterTest
- type BeforeTest
- type SetupAllSuite
- type SetupSubTest
- type SetupTestSuite
- type Suite
- func (s *Suite[T, G]) Assert() *assert.Assertions
- func (s *Suite[T, G]) Cleanup(f func())
- func (s *Suite[T, G]) Deadline() (deadline time.Time, ok bool)
- func (s *Suite[T, G]) Failed() bool
- func (s *Suite[T, G]) Fatal(args ...any)
- func (s *Suite[T, G]) Fatalf(format string, args ...any)
- func (s *Suite[T, G]) G() *G
- func (s *Suite[T, G]) Helper()
- func (s *Suite[T, G]) Log(args ...any)
- func (s *Suite[T, G]) Logf(format string, args ...any)
- func (s *Suite[T, G]) Name() string
- func (s *Suite[T, G]) Parallel()
- func (s *Suite[T, G]) Parent() *T
- func (s *Suite[T, G]) Require() *require.Assertions
- func (s *Suite[T, G]) Run(name string, subtest func(suite *T)) bool
- func (s *Suite[T, G]) Setenv(key, value string)
- func (s *Suite[T, G]) Skip(args ...any)
- func (s *Suite[T, G]) SkipNow()
- func (s *Suite[T, G]) Skipf(format string, args ...any)
- func (s *Suite[T, G]) Skipped() bool
- func (s *Suite[T, G]) T() *testing.T
- func (s *Suite[T, G]) TempDir() string
- type SuiteInformation
- type TearDownAllSuite
- type TearDownSubTest
- type TearDownTestSuite
- type TestInformation
- type WithStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AfterTest ¶
type AfterTest interface {
AfterTest(suiteName, testName string)
}
AfterTest has a function to be executed right after the test finishes and receives the suite and test names as input
type BeforeTest ¶
type BeforeTest interface {
BeforeTest(suiteName, testName string)
}
BeforeTest has a function to be executed right before the test starts and receives the suite and test names as input
type SetupAllSuite ¶
type SetupAllSuite interface {
SetupSuite()
}
SetupAllSuite has a SetupSuite method, which will run before the tests in the suite are run.
type SetupSubTest ¶
type SetupSubTest interface {
SetupSubTest()
}
SetupSubTest has a SetupSubTest method, which will run before each subtest in the suite.
type SetupTestSuite ¶
type SetupTestSuite interface {
SetupTest()
}
SetupTestSuite has a SetupTest method, which will run before each test in the suite.
type Suite ¶
type Suite[T any, G any] struct { *assert.Assertions // contains filtered or unexported fields }
func (*Suite[T, G]) Assert ¶
func (s *Suite[T, G]) Assert() *assert.Assertions
Assert returns an assert context for suite.
func (*Suite[T, G]) Require ¶
func (s *Suite[T, G]) Require() *require.Assertions
Require returns a require context for suite.
func (*Suite[T, G]) Run ¶
Run provides suite functionality around golang subtests. It should be called in place of t.Run(name, func(t *testing.T)) in test suite code. The passed-in func will be executed as a subtest with a fresh instance of t. Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName.
type SuiteInformation ¶
type SuiteInformation struct {
Start, End time.Time
TestStats map[string]*TestInformation
}
SuiteInformation stats stores stats for the whole suite execution.
func (SuiteInformation) Passed ¶
func (s SuiteInformation) Passed() bool
type TearDownAllSuite ¶
type TearDownAllSuite interface {
TearDownSuite()
}
TearDownAllSuite has a TearDownSuite method, which will run after all the tests in the suite have been run.
type TearDownSubTest ¶
type TearDownSubTest interface {
TearDownSubTest()
}
TearDownSubTest has a TearDownSubTest method, which will run after each subtest in the suite have been run.
type TearDownTestSuite ¶
type TearDownTestSuite interface {
TearDownTest()
}
TearDownTestSuite has a TearDownTest method, which will run after each test in the suite.
type TestInformation ¶
TestInformation stores information about the execution of each test.
type WithStats ¶
type WithStats interface {
HandleStats(suiteName string, stats *SuiteInformation)
}
WithStats implements HandleStats, a function that will be executed when a test suite is finished. The stats contain information about the execution of that suite and its tests.