scaffolding library
The core APIs for defining the structure of a test suite.
This library avoids exports of the package:matcher APIs from
package:test/expect.dart and can be used with alternative expectation
frameworks like package:checks.
Classes
- OnPlatform
- An annotation for platform-specific customizations for a test suite.
- Retry
- An annotation for marking a test suite to be retried.
- Skip
- An annotation for marking a test suite as skipped.
- Tags
- An annotation for applying a set of user-defined tags to a test suite.
- TestLocation
- The location of a test or group.
- TestOn
- An annotation indicating which platforms a test suite supports.
- Timeout
- A class representing a modification to the default timeout for a test.
Functions
-
addTearDown(
FutureOr callback()) → void - Registers a function to be run after the current test.
-
group(
Object? description, dynamic body(), {String? testOn, Timeout? timeout, Object? skip, Object? tags, Map< String, dynamic> ? onPlatform, int? retry, TestLocation? location, bool solo = false}) → void - Creates a group of tests.
-
markTestSkipped(
String message) → void - Marks the current test as skipped.
-
printOnFailure(
String message) → void -
Prints
messageif and when the current test fails. -
pumpEventQueue(
{int times = 20}) → Future -
Returns a Future that completes after the event loop has run the given
number of
times(20 by default). -
registerException(
Object error, [StackTrace stackTrace = StackTrace.empty]) → void - Registers an exception that was caught for the current test.
-
setUp(
FutureOr callback()) → void - Registers a function to be run before tests.
-
setUpAll(
FutureOr callback(), {TestLocation? location}) → void - Registers a function to be run once before all tests.
-
spawnHybridCode(
String dartCode, {Object? message, bool stayAlive = false}) → StreamChannel -
Spawns a VM isolate that runs the given
dartCode, which is loaded as the contents of a Dart library. -
spawnHybridUri(
Object uri, {Object? message, bool stayAlive = false}) → StreamChannel -
Spawns a VM isolate for the given
uri, which may be a Uri or a String. -
tearDown(
FutureOr callback()) → void - Registers a function to be run after tests.
-
tearDownAll(
FutureOr callback(), {TestLocation? location}) → void - Registers a function to be run once after all tests.
-
test(
Object? description, FutureOr body(), {String? testOn, Timeout? timeout, Object? skip, Object? tags, Map< String, dynamic> ? onPlatform, int? retry, TestLocation? location, bool solo = false}) → void - Creates a new test case with the given description (converted to a string) and body.