Testing utilities for Aqueduct applications

This library should be imported in test scripts. It should not be imported in application code.

Example:

import 'package:test/test.dart'; import 'package:aqueduct/aqueduct.dart'; import 'package:aqueduct/test.dart';

void main() { test("...", () async => ...); }

Constants

isBoolean → Matcher

Validates that expected result is a bool.

const isInstanceOf<bool>()
isDouble → Matcher

Validates that expected result is a double.

const isInstanceOf<double>()
isInteger → Matcher

Validates that expected result is an int.

const isInstanceOf<int>()
isNotPresent → _NotPresentMatcher

This instance is used to validate that a header or key does not exist.

const _NotPresentMatcher()
isNumber → Matcher

Validates that expected result is a num.

const isInstanceOf<num>()
isString → Matcher

Validates that expected result is a String.

const isInstanceOf<String>()

Properties

isTimestamp → Matcher

Validates that expected result is a ISO8601 timestamp.

read / write

Functions

asDateTime(term) → _Converter

Converts a header value to an instance of DateTime to be used inside a matcher.

asNumber(term) → _Converter

Converts a header value to an instance of int to be used inside a matcher.

hasBody(matchSpec) → _HTTPBodyMatcher

Validates that a TestResponse has the specified HTTP response body.

hasHeaders(Map<String, dynamic> matchers, { bool failIfContainsUnmatchedHeader: false }) → _HTTPHeaderMatcher

Validates that a TestResponse has the specified HTTP headers.

hasResponse(int statusCode, bodyMatcher, { Map<String, dynamic> headers: null, bool failIfContainsUnmatchedHeader: false }) → _HTTPResponseMatcher

Validates that a TestResponse has the specified status code, body and headers.

hasStatus(int statusCode) → _HTTPResponseMatcher

Validates that a TestResponse has the specified HTTP status code.

partial(Map map) → _PartialMapMatcher

A matcher that partially matches a Map.

Classes

MockHTTPRequest

The 'event' type for MockHTTPServer.

MockHTTPServer

This class is used as a utility for testing.

MockServer

This class is used as a utility for testing.

TestClient

Instances of this class are used during testing to make testing an HTTP server more convenient.

TestRequest

Instances of this type represent an HTTP request to be executed with a TestClient.

TestResponse

Instances of this type represent the response from executing a TestRequest.

Exceptions / Errors

TestClientException