test_api library

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.
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(dynamic 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, bool solo = false}) → void
Creates a group of tests.
markTestSkipped(String message) → void
Marks the current test as skipped.
printOnFailure(String message) → void
Prints message if 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(dynamic callback()) → void
Registers a function to be run before tests.
setUpAll(dynamic callback()) → 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(dynamic callback()) → void
Registers a function to be run after tests.
tearDownAll(dynamic callback()) → void
Registers a function to be run once after all tests.
test(Object? description, dynamic body(), {String? testOn, Timeout? timeout, Object? skip, Object? tags, Map<String, dynamic>? onPlatform, int? retry, bool solo = false}) → void
Creates a new test case with the given description (converted to a string) and body.

Exceptions / Errors

TestFailure
An exception thrown when a test assertion fails.