func Run(t *testing.T, suite TestingSuite)
Run takes a testing suite and runs all of the tests attached to it.
AfterTest has a function to be executed right after the test finishes and receives the suite and test names as input
type AfterTest interface { AfterTest(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 BeforeTest interface { BeforeTest(suiteName, testName string) }
SetupAllSuite has a SetupSuite method, which will run before the tests in the suite are run.
type SetupAllSuite interface { SetupSuite() }
SetupSubTest has a SetupSubTest method, which will run before each subtest in the suite.
type SetupSubTest interface { SetupSubTest() }
SetupTestSuite has a SetupTest method, which will run before each test in the suite.
type SetupTestSuite interface { SetupTest() }
Suite is a basic testing suite with methods for storing and retrieving the current *testing.T context.
type Suite struct { *assert.Assertions // contains filtered or unexported fields }
func (suite *Suite) Assert() *assert.Assertions
Assert returns an assert context for suite. Normally, you can call `suite.NoError(expected, actual)`, but for situations where the embedded methods are overridden (for example, you might want to override assert.Assertions with require.Assertions), this method is provided so you can call `suite.Assert().NoError()`.
func (suite *Suite) Require() *require.Assertions
Require returns a require context for suite.
func (suite *Suite) Run(name string, subtest func()) bool
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.
func (suite *Suite) SetS(s TestingSuite)
SetS needs to set the current test suite as parent to get access to the parent methods
func (suite *Suite) SetT(t *testing.T)
SetT sets the current *testing.T context.
func (suite *Suite) T() *testing.T
T retrieves the current *testing.T context.
SuiteInformation stats stores stats for the whole suite execution.
type SuiteInformation struct { Start, End time.Time TestStats map[string]*TestInformation }
func (s SuiteInformation) Passed() bool
TearDownAllSuite has a TearDownSuite method, which will run after all the tests in the suite have been run.
type TearDownAllSuite interface { TearDownSuite() }
TearDownSubTest has a TearDownSubTest method, which will run after each subtest in the suite have been run.
type TearDownSubTest interface { TearDownSubTest() }
TearDownTestSuite has a TearDownTest method, which will run after each test in the suite.
type TearDownTestSuite interface { TearDownTest() }
TestInformation stores information about the execution of each test.
type TestInformation struct { TestName string Start, End time.Time Passed bool }
TestingSuite can store and return the current *testing.T context generated by 'go test'.
type TestingSuite interface { T() *testing.T SetT(*testing.T) SetS(suite TestingSuite) }
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.
type WithStats interface { HandleStats(suiteName string, stats *SuiteInformation) }