TestEnvironment class abstract

A test environment.

You can get the current test environment with TestEnvironment.current. It will return null if the code is not running inside a test. If you just need to know whether a test is running, use isRunningInTest.

This does NOT require the package to depend on package:test.

Constructors

TestEnvironment()

Properties

closed bool
Tells whether the test is closed.
no setter
hashCode int
The hash code for this object.
no setterinherited
onClose Future<void>
A future that completes when the current test has been closed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addTearDown(FutureOr f()) → void
Adds a function that will be run when the test (or the test group) is torn down.
heartbeat() → void
Signals that the test is still alive.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printOnFailure(String message) → void
Prints the message on failure.
skip([String? message]) → void
Skips the test.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

current TestEnvironment?
Returns current test environment.
no setter