Documentation
¶
Index ¶
- func Run[T testingSuite](t *testing.T, s T, args ...any)
- func RunLegacySequential[T testingSuite](t *testing.T, s T, args ...any)deprecated
- type Scope
- type Suite
- func (b *Suite) Assert() *assert.Assertionsdeprecated
- func (s *Suite[T]) AssertionT() require.TestingT
- func (s *Suite[T]) Await(fn func(T), timeout, interval time.Duration)
- func (s *Suite[T]) AwaitTrue(fn func() bool, timeout, interval time.Duration)
- func (s *Suite[T]) AwaitTruef(fn func() bool, timeout, interval time.Duration, msg string, args ...any)
- func (s *Suite[T]) Awaitf(fn func(T), timeout, interval time.Duration, msg string, args ...any)
- func (s *Suite[T]) Context() context.Context
- func (s *Suite[T]) Require() *require.Assertions
- func (s *Suite[T]) Run(name string, fn func(T)) bool
- func (b *Suite) SetS(_ testifysuite.TestingSuite)deprecated
- func (b *Suite) SetT(_ *testing.T)deprecated
- func (s *Suite[T]) T() *testing.T
- func (s *Suite[T]) TB() testing.TB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run discovers and runs all exported Test* methods on the given suite in parallel.
Each method gets its own fresh suite instance initialized for the subtest's *testing.T. Both the suite-level test and each method subtest are marked as parallel. Any sequential setup must happen before calling Run.
The suite must embed Suite and have no other fields.
func RunLegacySequential
deprecated
Types ¶
type Scope ¶
type Scope interface {
Context() context.Context
TB() testing.TB
Require() *require.Assertions
AssertionT() require.TestingT
}
Scope provides the context and test handles for a test or await attempt. It is useful for test helpers.
type Suite ¶
type Suite[T testingSuite] struct {
*require.Assertions
protorequire.ProtoAssertions
historyrequire.HistoryRequire
// contains filtered or unexported fields
}
Suite provides parallel test execution with require-style (fail-fast) assertions.
It enforces a strict rule: a test method (or subtest) must either use assertions directly OR create subtests via Run — not both.
func (*Suite) Assert
deprecated
func (b *Suite) Assert() *assert.Assertions
Deprecated: Assert returns non-fatal assertions which are not supported. Use s.NoError, s.Equal, etc. directly (require semantics).
func (*Suite[T]) AssertionT ¶
AssertionT returns the active assertion target.
func (*Suite[T]) AwaitTrue ¶
AwaitTrue calls fn repeatedly until it returns true or timeout is reached.
Use it for simple local predicates only. Do not use assertions or side effects; use [Await] instead.
func (*Suite[T]) AwaitTruef ¶
func (s *Suite[T]) AwaitTruef(fn func() bool, timeout, interval time.Duration, msg string, args ...any)
AwaitTruef is like [AwaitTrue] but includes a format string appended to the failure message.
func (*Suite[T]) Awaitf ¶
Awaitf is like [Await] but includes a format string appended to the failure message.
func (*Suite[T]) Context ¶
Context returns the test-scoped context (created from testcontext). Inside an [Await] callback, it returns the await-scoped context.
func (*Suite[T]) Require ¶
func (s *Suite[T]) Require() *require.Assertions
Require returns assertions bound to the active test or await attempt.
func (*Suite[T]) Run ¶
Run creates a parallel subtest. The callback receives a fresh copy of the concrete suite type, initialized for the subtest's *testing.T.
func (*Suite) SetS
deprecated
func (b *Suite) SetS(_ testifysuite.TestingSuite)
Deprecated: SetS is managed internally by Run. Do not call directly.