Declarer class

A class that manages the state of tests as they're declared.

A nested tree of Declarers tracks the current group, set-up, and tear-down functions. Each Declarer in the tree corresponds to a group. This tree is tracked by a zone-scoped "current" Declarer; the current declarer can be set for a block using Declarer.declare, and it can be accessed using Declarer.current.

Constructors

Declarer({Metadata? metadata, Set<String>? platformVariables, bool collectTraces = false, bool noRetry = false, String? fullTestName, bool allowDuplicateTestNames = true, bool isStandalone = false})
Creates a new declarer for the root group.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addTearDownAll(FutureOr callback()) → void
Like tearDownAll, but called from within a running setUpAll test to dynamically add a tearDownAll.
build() Group
Finalizes and returns the group being declared.
declare<T>(T body(), {Map<Symbol, Object?>? zoneValues}) → T
Runs body with this declarer as Declarer.current.
group(String name, void body(), {String? testOn, Timeout? timeout, Object? skip, Map<String, dynamic>? onPlatform, Object? tags, TestLocation? location, int? retry, bool solo = false}) → void
Creates a group of tests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setUp(FutureOr callback()) → void
Registers a function to be run before each test in this group.
setUpAll(FutureOr callback(), {TestLocation? location}) → void
Registers a function to be run once before all tests.
tearDown(FutureOr callback()) → void
Registers a function to be run after each test in this group.
tearDownAll(FutureOr callback(), {TestLocation? location}) → void
Registers a function to be run once after all tests.
test(String name, FutureOr body(), {String? testOn, Timeout? timeout, Object? skip, Map<String, dynamic>? onPlatform, Object? tags, TestLocation? location, int? retry, bool solo = false}) → void
Defines a test case with the given name and body.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

current Declarer?
The current zone-scoped declarer.
no setter