test
1.33.0, released 6 weeks ago by dart.dev
A full featured library for writing and running Dart tests across platforms.
What it does
Provides a standard way of writing and running tests in Dart across multiple platforms like VM, browsers, and node. It supports grouping tests, setting up and tearing down state, sharding, and collecting code coverage.
AI-written summary of version 1.33.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to write unit, widget, or integration tests in Dart or Flutter.
- You want to run tests across multiple platforms such as Chrome and the Dart VM.
- You need features like sharding, custom test reporters, or code coverage collection.
Skip it when
- You are not writing Dart or Flutter code.
Strengths
- Cross-platform test runner supporting VM, browsers, and more.
- Rich features including sharding, test concurrency, and randomization.
- Built-in support for code coverage and multiple output reporters.
Weaknesses
- Can be complex to configure for advanced browser or hybrid test setups.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 25
Not documented
import 'package:test/test.dart';
void main() {
test('String.split() splits the string on the delimiter', () {
var string = 'foo,bar,baz';
expect(string.split(','), equals(['foo', 'bar', 'baz']));
});
}Alternatives
Packages that do the same job and could replace test.
- benchmark
A full featured library for writing and running Dart benchmarks.
50Compare - patrol_log
Log package for Patrol, a Flutter-native UI testing framework
87Compare - golden_test
A zero-dependency wrapper for Flutter golden tests with theme, locale, and multi-device support.
79Compare - fluttersdk_dusk
Flutter E2E test driver for LLM agents and CLI via VM Service extensions without a test harness.
77Compare
Works with
Packages commonly used together with test: ones it builds on, ones built on it, and its own family.
- analyzertest depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamltest depends on itA Dart library for parsing YAML documents into Dart data structures.
- stack_tracetest depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- package_configtest depends on itRead and write Dart package configuration files.
- pooltest depends on itManage a finite pool of resources to control concurrent operations.
- iotest depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- coveragetest depends on itCollects, manipulates, and formats code coverage data in Dart
- asynctest depends on itUtility classes and helpers that extend Dart's async library.