Test<TestContext extends Context> class

Create a Test with a Custom Context

Tests are where you write your action and assertions. They will return a _TestResult when ran, determining if the test passed, failed, or is inconclusive (skipped).

Inheritance

Constructors

Test(String _title, {FutureOr<void> setup(TestContext test)?, FutureOr<void> teardown(TestContext test)?, FutureOr action(TestContext test)?, required List<Expect> assertions(TestContext test), FutureOr<TestContext> contextBuilder()?, TestOptions? options})
Test.skip(String _title, {FutureOr<void> setup(TestContext test)?, FutureOr<void> teardown(TestContext test)?, FutureOr action(TestContext test)?, required List<Expect> assertions(TestContext test), FutureOr<TestContext> contextBuilder()?, TestOptions? options})
Skipped. This will not run any of the stages within this test.
Test.stub(String _title, {FutureOr<TestContext> contextBuilder()?})
Stubbed. This will be skipped and is meant to be used as a placeholder.

Properties

action FutureOr Function(TestContext test)?
finalinherited
assertFailures List<AssertResult>
finalinherited
assertions List<Expect> Function(TestContext test)
finalinherited
contextualType String
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
options TestOptions
no setterinherited
ranSuccessfully bool?
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setup FutureOr<void> Function(TestContext test)?
finalinherited
skip bool
finalinherited
teardown FutureOr<void> Function(TestContext test)?
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
report(FilterSettings filterSettings) → void
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited