unittest package has been renamed
test. It will export
API through the
0.12.x branch, but it is deprecated and
test should be used
- Fix an incorrect use of
- Depend on
If a future matched against the
completion()matcher throws an error, that error is printed directly rather than being wrapped in a string. This allows such errors to be captured using the Zone API and improves formatting.
In order to be more extensible, all exception handling within tests now uses the Zone API.
Add a heartbeat to reset a test's timeout whenever the test interacts with the test infrastructure.
expectAsyncUntil()throw more useful errors if called outside a test body.
Improve the browser test suite timeout logic to avoid timeouts when running many browser suites at once.
- Add a
--verbose-traceflag to include core library frames in stack traces.
Test Runner #
0.12.0 adds support for a test runner, which can be run via
pub run test:test (or
pub run test in Dart 1.10). By default it runs all files
recursively in the
test/ directory that end in
_test.dart and aren't in a
The test runner supports running tests on the Dart VM and many different
browsers. Test files can use the
@TestOn annotation to declare which platforms
they support. For more information on this and many more new features, see the
Removed and Changed APIs #
As part of moving to a runner-based model, most test configuration is moving out
of the test file and into the runner. As such, many ancillary APIs have been
removed. These APIs include
all its subclasses,
getOrCreateExpectFailureHandler which used to be exported from the
package have also been removed. They existed to enable integration between
matcher that has been streamlined.
A number of APIs from
matcher have been into
Throws, and all of the
throws methods. Some of these have changed slightly:
expectno longer has a named
expectadded an optional
- Internal code cleanups and documentation improvements.
- Bumped the version constraint for
- Bump the version constraint for
- Narrow the constraint on matcher to ensure that new features are reflected in unittest's version.
- Prints a warning instead of throwing an error when setting the test configuration after it has already been set. The first configuration is always used.
- Fix bug in withTestEnvironment where test cases were not reinitialized if called multiple times.
reasonnamed argument to
expectAsyncUntil, which has the same definition as
- Added support for private test environments.
- Refactored package tests.
- Release test functions after each test is run.
- Fix for 20153
- Updated maximum
- Removed unused files from tests and standardized remaining test file names.
- Widen the version constraint for
- Deprecated methods have been removed:
guardAsync- no longer needed
protectAsync2- no longer needed
mirror_matchers.darthave been removed. They are now in the
mock.darthas been removed. It is now in the
- Fixed deprecation message for
- Fixed CHANGELOG
- Moved to triple-slash for all doc comments.
mirror_matchers.dartare now in the
mock.dartis now in the
equalsnow allows a nested matcher as an expected list element or map value when doing deep matching.
expectAsyncUntilnow support up to 6 positional arguments and correctly handle functions with optional positional arguments with default values.
- Each test is run in a separate
Zone. This ensures that any exceptions that occur is async operations are reported back to the source test case.
- Running each test in a
Zoneaddresses the need for these methods.
- Running each test in a
expectAsyncreplaces the now deprecated
expectAsyncUntilreplaces the now deprecated
- Removed properties:
enabledis now get-only
- Removed methods:
- Removed properties:
interactive_html_config.darthas been removed.
solo_groupnow throw a
StateErrorif called while tests are running.
rerunTestshas been removed.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: unittest: ^0.12.4+1
2. Install it
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
This package is not analyzed, because it is discontinued.
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Analysis issues and suggestions
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.