flutter_test library

Testing library for flutter, built on top of package:test.

Test Configuration

The testing library exposes a few constructs by which projects may configure their tests.

Per test or per file

Due to its use of package:test as a foundation, the testing library allows for tests to be initialized using the existing constructs found in package:test. These include the setUp and setUpAll methods.

Per directory hierarchy

In addition to the constructs provided by package:test, this library supports the configuration of tests at the directory level.

Before a test file is executed, the Flutter test framework will scan up the directory hierarchy, starting from the directory in which the test file resides, looking for a file named flutter_test_config.dart. If it finds such a configuration file, the file will be assumed to have a main method with the following signature:

Future<void> main(FutureOr<void> testMain());

The test framework will execute that method and pass it the main() method of the test. It is then the responsibility of the configuration file's main() method to invoke the test's main() method.

After the test framework finds a configuration file, it will stop scanning the directory hierarchy. In other words, the test configuration file that lives closest to the test file will be selected, and all other test configuration files will be ignored. Likewise, it will stop scanning the directory hierarchy when it finds a pubspec.yaml, since that signals the root of the project.

If no configuration file is located, the test will be executed like normal.

Classes

AutomatedTestWidgetsFlutterBinding
A variant of TestWidgetsFlutterBinding for executing tests in the flutter test environment. [...]
CommonFinders
Provides lightweight syntax for getting frequently used widget Finders. [...]
CustomMatcher
A useful utility class for implementing other matchers through inheritance. Derived classes should call the base constructor with a feature name and description, and an instance matcher, and should implement the featureValueOf abstract method. [...]
Description
Matchers build up their error messages by appending to Description objects. This interface is implemented by StringDescription. This interface is unlikely to need other implementations, but could be useful to replace in some cases - e.g. language conversion.
Finder
Searches a widget tree and returns nodes that match a particular pattern.
Future<T>
An object representing a delayed computation. [...]
GoldenFileComparator
Compares rasterized image bytes against a golden image file. [...]
isInstanceOf<T>
Returns a matcher that matches if an object is an instance of T (or a subtype). [...]
LiveTestWidgetsFlutterBinding
A variant of TestWidgetsFlutterBinding for executing tests in the flutter run environment, on a device. This is intended to allow interactive test development. [...]
LocalFileComparator
The default GoldenFileComparator implementation for flutter test. [...]
Matcher
expect Matchers must implement/extend the Matcher class. [...]
MatchFinder
Searches a widget tree and returns nodes that match a particular pattern.
Offset
An immutable 2D floating-point offset. [...]
OnPlatform
An annotation for platform-specific customizations for a test suite. [...]
Skip
An annotation for marking a test suite as skipped.
StreamMatcher
A matcher that matches events from Streams or StreamQueues. [...]
StringDescription
The default implementation of Description. This should rarely need substitution, although conceivably it is a place where other languages could be supported.
Tags
An annotation for applying a set of user-defined tags to a test suite. [...]
TestAsyncUtils
Utility class for all the async APIs in the flutter_test library. [...]
TestFailure
An exception thrown when a test assertion fails.
TestGesture
A class for performing gestures in tests. [...]
TestOn
An annotation indicating which platforms a test suite supports. [...]
TestPointer
A class for generating coherent artificial pointer events. [...]
TestTextInput
A testing stub for the system's onscreen keyboard. [...]
TestViewConfiguration
A ViewConfiguration that pretends the display is of a particular size. The size is in logical pixels. The resulting ViewConfiguration maps the given size onto the actual display using the BoxFit.contain algorithm.
TestVSync
A TickerProvider that creates a standalone ticker. [...]
TestWidgetsFlutterBinding
Base class for bindings used by widgets library tests. [...]
Throws
Use the throwsA function instead.
Timeout
A class representing a modification to the default timeout for a test. [...]
TypeMatcher
WidgetController
Class that programmatically interacts with widgets. [...]
WidgetTester
Class that programmatically interacts with widgets and the test environment. [...]

Constants

anything → const Matcher
A matcher that matches any value.
const _IsAnything()
clipsWithBoundingRect → const Matcher
Asserts that a Finder locates a single object whose root RenderObject is a RenderClipRect with no clipper set, or an equivalent RenderClipPath.
const _ClipsWithBoundingRect()
find → const CommonFinders
Some frequently used widget Finders.
const CommonFinders._()
findsNothing → const Matcher
Asserts that the Finder matches no widgets in the widget tree. [...]
const _FindsWidgetMatcher(null, 0)
findsOneWidget → const Matcher
Asserts that the Finder locates at exactly one widget in the widget tree. [...]
const _FindsWidgetMatcher(1, 1)
findsWidgets → const Matcher
Asserts that the Finder locates at least one widget in the widget tree. [...]
const _FindsWidgetMatcher(1, null)
hasAGoodToStringDeep → const Matcher
Asserts that an object's toStringDeep() is a plausible multi-line description. [...]
const _HasGoodToStringDeep()
hasOneLineDescription → const Matcher
Asserts that an object's toString() is a plausible one-line description. [...]
const _HasOneLineDescription()
isArgumentError → const Matcher
A matcher for ArgumentErrors.
const _ArgumentError()
isAssertionError → const Matcher
A matcher for AssertionError. [...]
const isInstanceOf<AssertionError>()
isConcurrentModificationError → const Matcher
A matcher for ConcurrentModificationError.
const _ConcurrentModificationError()
isCyclicInitializationError → const Matcher
A matcher for CyclicInitializationError.
const _CyclicInitializationError()
isEmpty → const Matcher
Returns a matcher that matches the isEmpty property.
const _Empty()
isException → const Matcher
A matcher for Exceptions.
const _Exception()
isFalse → const Matcher
A matcher that matches anything except the Boolean value true.
const _IsFalse()
isFlutterError → const Matcher
A matcher for FlutterError. [...]
const isInstanceOf<FlutterError>()
isFormatException → const Matcher
A matcher for FormatExceptions.
const _FormatException()
isInCard → const Matcher
Asserts that the Finder locates the a single widget that has at least one Card widget ancestor. [...]
const _IsInCard()
isList → const Matcher
A matcher for List types.
const _IsList()
isMap → const Matcher
A matcher for Map types.
const _IsMap()
isNaN → const Matcher
A matcher that matches the numeric value NaN.
const _IsNaN()
isNegative → const Matcher
A matcher which matches if the match argument is negative.
const _OrderingMatcher(0, false, true, false, 'a negative value', false)
isNonNegative → const Matcher
A matcher which matches if the match argument is zero or positive.
const _OrderingMatcher(0, true, false, true, 'a non-negative value', false)
isNonPositive → const Matcher
A matcher which matches if the match argument is zero or negative.
const _OrderingMatcher(0, true, true, false, 'a non-positive value', false)
isNonZero → const Matcher
A matcher which matches if the match argument is non-zero.
const _OrderingMatcher(0, false, true, true, 'a value not equal to')
isNoSuchMethodError → const Matcher
A matcher for NoSuchMethodErrors.
const _NoSuchMethodError()
isNotEmpty → const Matcher
Returns a matcher that matches the isNotEmpty property.
const _NotEmpty()
isNotInCard → const Matcher
Asserts that the Finder locates the a single widget that has no Card widget ancestors. [...]
const _IsNotInCard()
isNotNaN → const Matcher
A matcher that matches any non-NaN value.
const _IsNotNaN()
isNotNull → const Matcher
A matcher that matches any non-null value.
const _IsNotNull()
isNull → const Matcher
A matcher that matches any null value.
const _IsNull()
isNullThrownError → const Matcher
A matcher for NullThrownError.
const _NullThrownError()
isOffstage → const Matcher
Asserts that the Finder locates the a single widget that has at least one Offstage widget ancestor. [...]
const _IsOffstage()
isOnstage → const Matcher
Asserts that the Finder locates the a single widget that has no Offstage widget ancestors. [...]
const _IsOnstage()
isPositive → const Matcher
A matcher which matches if the match argument is positive.
const _OrderingMatcher(0, false, false, true, 'a positive value', false)
isRangeError → const Matcher
A matcher for RangeErrors.
const _RangeError()
isStateError → const Matcher
A matcher for StateErrors.
const _StateError()
isTrue → const Matcher
A matcher that matches the Boolean value true.
const _IsTrue()
isUnimplementedError → const Matcher
A matcher for UnimplementedErrors.
const _UnimplementedError()
isUnsupportedError → const Matcher
A matcher for UnsupportedError.
const _UnsupportedError()
isZero → const Matcher
A matcher which matches if the match argument is zero.
const _OrderingMatcher(0, true, false, false, 'a value equal to')
returnsNormally → const Matcher
A matcher that matches a function call against no exception. [...]
const _ReturnsNormally()
throws → const Matcher
This function is deprecated. [...]
@Deprecated("Will be removed in 0.13.0")
const Throws()
throwsArgumentError → const Matcher
A matcher for functions that throw ArgumentError.
const Throws(isArgumentError)
throwsConcurrentModificationError → const Matcher
A matcher for functions that throw ConcurrentModificationError.
const Throws(isConcurrentModificationError)
throwsCyclicInitializationError → const Matcher
A matcher for functions that throw CyclicInitializationError.
const Throws(isCyclicInitializationError)
throwsException → const Matcher
A matcher for functions that throw Exception.
const Throws(isException)
throwsFormatException → const Matcher
A matcher for functions that throw FormatException.
const Throws(isFormatException)
throwsNoSuchMethodError → const Matcher
A matcher for functions that throw NoSuchMethodError.
const Throws(isNoSuchMethodError)
throwsNullThrownError → const Matcher
A matcher for functions that throw NullThrownError.
const Throws(isNullThrownError)
throwsRangeError → const Matcher
A matcher for functions that throw RangeError.
const Throws(isRangeError)
throwsStateError → const Matcher
A matcher for functions that throw StateError.
const Throws(isStateError)
throwsUnimplementedError → const Matcher
A matcher for functions that throw Exception.
const Throws(isUnimplementedError)
throwsUnsupportedError → const Matcher
A matcher for functions that throw UnsupportedError.
const Throws(isUnsupportedError)

Properties

autoUpdateGoldenFiles bool
Whether golden files should be automatically updated during tests rather than compared to the image bytes recorded by the tests. [...]
read / write
completes Matcher
Matches a Future that completes successfully with a value. [...]
final
doesNotComplete Matcher
Matches a Future that does not complete. [...]
final
emitsDone StreamMatcher
Returns a StreamMatcher that asserts that the stream emits a "done" event.
final
goldenFileComparator GoldenFileComparator
Compares rasterized image bytes against a golden image file. [...]
read / write
neverCalled → T Function<T>([Object, Object, Object, Object, Object, Object, Object, Object, Object, Object ])
Returns a function that causes the test to fail if it's called. [...]
read-only
reportTestException TestExceptionReporter
A function that is called by the test framework when an unexpected error occurred during a test. [...]
read / write
runningOnTravis bool
Whether the test is running in a Travis CI environment.
read-only
throwsAssertionError Matcher
A matcher for functions that throw AssertionError. [...]
final
throwsFlutterError Matcher
A matcher for functions that throw FlutterError. [...]
final

Functions

addStateInfo(Map matchState, Map values) → void
Useful utility for nesting match states.
addTearDown(dynamic callback()) → void
Registers a function to be run after the current test. [...]
allOf(dynamic arg0, [ dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5, dynamic arg6 ]) Matcher
This returns a matcher that matches if all of the matchers passed as arguments (up to 7) match. [...]
anyElement(dynamic matcher) Matcher
Returns a matcher which matches Iterables in which at least one element matches the given matcher.
anyOf(dynamic arg0, [ dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5, dynamic arg6 ]) Matcher
Matches if any of the given matchers evaluate to true. [...]
benchmarkWidgets(WidgetTesterCallback callback) Future<Null>
Runs the callback inside the Flutter benchmark environment. [...]
clipsWithBoundingRRect({BorderRadius borderRadius }) Matcher
Asserts that a Finder locates a single object whose root RenderObject is a RenderClipRRect with no clipper set, and border radius equals to borderRadius, or an equivalent RenderClipPath.
clipsWithShapeBorder({ShapeBorder shape }) Matcher
Asserts that a Finder locates a single object whose root RenderObject is a RenderClipPath with a ShapeBorderClipper that clips to shape.
closeTo(num value, num delta) Matcher
Returns a matcher which matches if the match argument is within delta of some value. [...]
collapseWhitespace(String string) String
Utility function to collapse whitespace runs to single spaces and strip leading/trailing whitespace.
collectAllElementsFrom(Element rootElement, { bool skipOffstage }) Iterable<Element>
Provides an iterable that efficiently returns all the elements rooted at the given element. See CachingIterable for details. [...]
completion(dynamic matcher, [ String description ]) Matcher
Matches a Future that completes succesfully with a value that matches matcher. [...]
contains(dynamic expected) Matcher
Returns a matcher that matches if the match argument contains the expected value. [...]
containsAll(Iterable expected) Matcher
Matches Iterables which contain an element matching every value in expected in any order, and may contain additional values. [...]
containsAllInOrder(Iterable expected) Matcher
Matches Iterables which contain an element matching every value in expected in the same order, but may contain additional values interleaved throughout. [...]
containsPair(dynamic key, dynamic value) Matcher
Returns a matcher which matches maps containing the key-value pair with key => value.
containsValue(dynamic value) Matcher
Returns a matcher which matches maps containing the given value.
coversSameAreaAs(Path expectedPath, { Rect areaToCompare, int sampleSize: 20 }) Matcher
Asserts that 2 paths cover the same area by sampling multiple points. [...]
emits(dynamic matcher) StreamMatcher
Returns a StreamMatcher for matcher. [...]
emitsAnyOf(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if at least one of matchers matches. [...]
emitsError(dynamic matcher) StreamMatcher
Returns a StreamMatcher that matches a single error event that matches matcher.
emitsInAnyOrder(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if each matcher in matchers matches, in any order. [...]
emitsInOrder(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if each matcher in matchers matches, one after another. [...]
emitsThrough(dynamic matcher) StreamMatcher
Returns a StreamMatcher that matches any number of events followed by events that match matcher. [...]
endsWith(String suffixString) Matcher
Returns a matcher that matches if the match argument is a string and ends with suffixString.
equals(dynamic expected, [ int limit = 100 ]) Matcher
Returns a matcher that matches if the value is structurally equal to expected. [...]
equalsIgnoringCase(String value) Matcher
Returns a matcher which matches if the match argument is a string and is equal to value when compared case-insensitively.
equalsIgnoringHashCodes(String value) Matcher
Asserts that two Strings are equal after normalizing likely hash codes. [...]
equalsIgnoringWhitespace(String value) Matcher
Returns a matcher which matches if the match argument is a string and is equal to value, ignoring whitespace. [...]
escape(String str) String
Returns str with all whitespace characters represented as their escape sequences. [...]
everyElement(dynamic matcher) Matcher
Returns a matcher which matches Iterables in which all elements match the given matcher.
expect(dynamic actual, dynamic matcher, { String reason, dynamic skip }) → void
Assert that actual matches matcher. [...]
expectAsync(Function callback, { int count: 1, int max: 0, String id, String reason }) Function
This function is deprecated because it doesn't work well with strong mode. Use expectAsync0, expectAsync1, expectAsync2, expectAsync3, expectAsync4, expectAsync5, or expectAsync6 instead.
@Deprecated("Will be removed in 0.13.0")
expectAsync0<T>(T callback(), { int count: 1, int max: 0, String id, String reason }) Func0<T>
Informs the framework that the given callback of arity 0 is expected to be called count number of times (by default 1). [...]
expectAsync1<T, A>(T callback(A a), { int count: 1, int max: 0, String id, String reason }) Func1<T, A>
Informs the framework that the given callback of arity 1 is expected to be called count number of times (by default 1). [...]
expectAsync2<T, A, B>(T callback(A a, B b), { int count: 1, int max: 0, String id, String reason }) Func2<T, A, B>
Informs the framework that the given callback of arity 2 is expected to be called count number of times (by default 1). [...]
expectAsync3<T, A, B, C>(T callback(A a, B b, C c), { int count: 1, int max: 0, String id, String reason }) Func3<T, A, B, C>
Informs the framework that the given callback of arity 3 is expected to be called count number of times (by default 1). [...]
expectAsync4<T, A, B, C, D>(T callback(A a, B b, C c, D d), { int count: 1, int max: 0, String id, String reason }) Func4<T, A, B, C, D>
Informs the framework that the given callback of arity 4 is expected to be called count number of times (by default 1). [...]
expectAsync5<T, A, B, C, D, E>(T callback(A a, B b, C c, D d, E e), { int count: 1, int max: 0, String id, String reason }) Func5<T, A, B, C, D, E>
Informs the framework that the given callback of arity 5 is expected to be called count number of times (by default 1). [...]
expectAsync6<T, A, B, C, D, E, F>(T callback(A a, B b, C c, D d, E e, F f), { int count: 1, int max: 0, String id, String reason }) Func6<T, A, B, C, D, E, F>
Informs the framework that the given callback of arity 6 is expected to be called count number of times (by default 1). [...]
expectAsyncUntil(Function callback, bool isDone(), { String id, String reason }) Function
This function is deprecated because it doesn't work well with strong mode. Use expectAsyncUntil0, expectAsyncUntil1, expectAsyncUntil2, expectAsyncUntil3, expectAsyncUntil4, expectAsyncUntil5, or expectAsyncUntil6 instead.
@Deprecated("Will be removed in 0.13.0")
expectAsyncUntil0<T>(T callback(), bool isDone(), { String id, String reason }) Func0<T>
Informs the framework that the given callback of arity 0 is expected to be called until isDone returns true. [...]
expectAsyncUntil1<T, A>(T callback(A a), bool isDone(), { String id, String reason }) Func1<T, A>
Informs the framework that the given callback of arity 1 is expected to be called until isDone returns true. [...]
expectAsyncUntil2<T, A, B>(T callback(A a, B b), bool isDone(), { String id, String reason }) Func2<T, A, B>
Informs the framework that the given callback of arity 2 is expected to be called until isDone returns true. [...]
expectAsyncUntil3<T, A, B, C>(T callback(A a, B b, C c), bool isDone(), { String id, String reason }) Func3<T, A, B, C>
Informs the framework that the given callback of arity 3 is expected to be called until isDone returns true. [...]
expectAsyncUntil4<T, A, B, C, D>(T callback(A a, B b, C c, D d), bool isDone(), { String id, String reason }) Func4<T, A, B, C, D>
Informs the framework that the given callback of arity 4 is expected to be called until isDone returns true. [...]
expectAsyncUntil5<T, A, B, C, D, E>(T callback(A a, B b, C c, D d, E e), bool isDone(), { String id, String reason }) Func5<T, A, B, C, D, E>
Informs the framework that the given callback of arity 5 is expected to be called until isDone returns true. [...]
expectAsyncUntil6<T, A, B, C, D, E, F>(T callback(A a, B b, C c, D d, E e, F f), bool isDone(), { String id, String reason }) Func6<T, A, B, C, D, E, F>
Informs the framework that the given callback of arity 6 is expected to be called until isDone returns true. [...]
expectLater(dynamic actual, dynamic matcher, { String reason, dynamic skip }) Future<void>
Just like expect, but returns a Future that completes when the matcher has finished matching. [...]
expectSync(dynamic actual, dynamic matcher, { String reason }) → void
Assert that actual matches matcher. [...]
fail(String message) Null
Convenience method for throwing a new TestFailure with the provided message.
@alwaysThrows
findsNWidgets(int n) Matcher
Asserts that the Finder locates the specified number of widgets in the widget tree. [...]
greaterThan(dynamic value) Matcher
Returns a matcher which matches if the match argument is greater than the given value.
greaterThanOrEqualTo(dynamic value) Matcher
Returns a matcher which matches if the match argument is greater than or equal to the given value.
group(dynamic description, dynamic body(), { String testOn, Timeout timeout, dynamic skip, dynamic tags, Map<String, dynamic> onPlatform, int retry }) → void
Creates a group of tests. [...]
hasLength(dynamic matcher) Matcher
Returns a matcher that matches if an object has a length property that matches matcher.
inClosedOpenRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than or equal to a low and less than high.
inExclusiveRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than low and less than high.
inInclusiveRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than or equal to low and less than or equal to high.
inOpenClosedRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than low and less than or equal to high.
isIn(dynamic expected) Matcher
Returns a matcher that matches if the match argument is in the expected value. This is the converse of contains.
isMethodCall(String name, { dynamic arguments }) Matcher
A matcher for MethodCalls, asserting that it has the specified method name and arguments. [...]
isNot(dynamic matcher) Matcher
This returns a matcher that inverts matcher to its logical negation.
lessThan(dynamic value) Matcher
Returns a matcher which matches if the match argument is less than the given value.
lessThanOrEqualTo(dynamic value) Matcher
Returns a matcher which matches if the match argument is less than or equal to the given value.
matches(dynamic re) Matcher
Returns a matcher that matches if the match argument is a string and matches the regular expression given by re. [...]
matchesGoldenFile(dynamic key) Matcher
Asserts that a Finder matches exactly one widget whose rendered image matches the golden image file identified by key. [...]
mayEmit(dynamic matcher) StreamMatcher
Returns a StreamMatcher that allows (but doesn't require) matcher to match the stream. [...]
mayEmitMultiple(dynamic matcher) StreamMatcher
Returns a StreamMatcher that matches any number of events that match matcher. [...]
moreOrLessEquals(double value, { double epsilon: 1e-10 }) Matcher
Asserts that two doubles are equal, within some tolerated error. [...]
neverEmits(dynamic matcher) StreamMatcher
Returns a StreamMatcher that matches a stream that never matches matcher. [...]
nonconst<T>(T t) → T
This function can be used to call a const constructor in such a way as to create a new instance rather than creating the common const instance. [...]
orderedEquals(Iterable expected) Matcher
Returns a matcher which matches Iterables that have the same length and the same elements as expected, in the same order. [...]
pairwiseCompare<S, T>(Iterable<S> expected, bool comparator(S a, T b), String description) Matcher
A pairwise matcher for Iterables. [...]
predicate<T>(bool f(T value), [ String description = 'satisfies function' ]) Matcher
Returns a matcher that uses an arbitrary function that returns true or false for the actual value. [...]
printOnFailure(String message) → void
Prints message if and when the current test fails. [...]
prints(dynamic matcher) Matcher
Matches a Function that prints text that matches matcher. [...]
pumpEventQueue({int times }) Future
Returns a Future that completes after the event loop has run the given number of times (20 by default). [...]
registerException(dynamic error, [ StackTrace stackTrace ]) → void
Registers an exception that was caught for the current test.
rendersOnPhysicalModel({BoxShape shape, BorderRadius borderRadius, double elevation }) Matcher
Asserts that a Finder locates a single object whose root RenderObject is a RenderPhysicalModel or a RenderPhysicalShape. [...]
rendersOnPhysicalShape({ShapeBorder shape, double elevation }) Matcher
Asserts that a Finder locates a single object whose root RenderObject is RenderPhysicalShape that uses a ShapeBorderClipper that clips to shape as its clipper. If elevation is non null asserts that RenderPhysicalShape.elevation is equal to elevation.
reportExpectCall(StackTrace stack, StringBuffer information) int
Report call site for expect() call. Returns the number of frames that should be elided if a stack were to be modified to hide the expect call, or zero if no such call was found. [...]
same(dynamic expected) Matcher
Returns a matches that matches if the value is the same instance as expected, using identical.
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(dynamic uri, { Object message, bool stayAlive: false }) StreamChannel
Spawns a VM isolate for the given uri, which may be a Uri or a String. [...]
startsWith(String prefixString) Matcher
Returns a matcher that matches if the match argument is a string and starts with prefixString.
stringContainsInOrder(List<String> substrings) Matcher
Returns a matcher that matches if the match argument is a string and contains a given list of substrings in relative order. [...]
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(dynamic description, dynamic body(), { String testOn, Timeout timeout, dynamic skip, dynamic tags, Map<String, dynamic> onPlatform, int retry }) → void
Creates a new test case with the given description (converted to a string) and body. [...]
testWidgets(String description, WidgetTesterCallback callback, { bool skip: false, Timeout timeout }) → void
Runs the callback inside the Flutter test environment. [...]
@isTest
throwsA(dynamic matcher) Matcher
This can be used to match three kinds of objects: [...]
unorderedEquals(Iterable expected) Matcher
Returns a matcher which matches Iterables that have the same length and the same elements as expected, but not necessarily in the same order. [...]
unorderedMatches(Iterable expected) Matcher
Returns a matcher which matches Iterables whose elements match the matchers in expected, but not necessarily in the same order. [...]
within<T>({num distance, T from, DistanceFunction<T> distanceFunction }) Matcher
Asserts that two values are within a certain distance from each other. [...]
wrapMatcher(dynamic x) Matcher
Takes an argument and returns an equivalent Matcher. [...]

Enums

EnginePhase
Phases that can be reached by WidgetTester.pumpWidget and TestWidgetsFlutterBinding.pump. [...]
LiveTestWidgetsFlutterBindingFramePolicy
Available policies for how a LiveTestWidgetsFlutterBinding should paint frames. [...]
TestBindingEventSource
Parts of the system that can generate pointer events that reach the test binding. [...]

Typedefs

AnyDistanceFunction(Null a, Null b) num
The type of a union of instances of DistanceFunction<T> for various types T. [...]
DistanceFunction<T>(T a, T b) num
Computes the distance between two values. [...]
ElementPredicate(Element element) bool
Signature for CommonFinders.byElementPredicate.
ErrorFormatter(dynamic actual, Matcher matcher, String reason, Map matchState, bool verbose) String
The type used for functions that can be used to build up error reports upon failures in expect.
@Deprecated("Will be removed in 0.13.0.")
EventDispatcher(PointerEvent event, HitTestResult result) Future<Null>
Signature for a callback that can dispatch events and returns a future that completes when the event dispatch is complete.
Func0<T>() → T
Func1<T, A>([A a ]) → T
Func2<T, A, B>([A a, B b ]) → T
Func3<T, A, B, C>([A a, B b, C c ]) → T
Func4<T, A, B, C, D>([A a, B b, C c, D d ]) → T
Func5<T, A, B, C, D, E>([A a, B b, C c, D d, E e ]) → T
Func6<T, A, B, C, D, E, F>([A a, B b, C c, D d, E e, F f ]) → T
HitTester(Offset location) HitTestResult
Signature for callbacks that perform hit-testing at a given location.
TestExceptionReporter(FlutterErrorDetails details, String testDescription) → void
Signature for the reportTestException callback.
WidgetPredicate(Widget widget) bool
Signature for CommonFinders.byWidgetPredicate.
WidgetTesterCallback(WidgetTester widgetTester) Future<Null>
Signature for callback to testWidgets and benchmarkWidgets.