test_util 0.1.1 copy "test_util: ^0.1.1" to clipboard
test_util: ^0.1.1 copied to clipboard

Helpers and utilities for testing: running Dart processes and expecting output.

example/main.dart

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

void main() {
  test('A dart program succeeds', () async {
    await dartPubGet();
    final result = await dartRun(
      ['hello.dart', 'Alexey'],
      workingDirectory: 'example',
    );

    expect(result.stdout, 'Hello, Alexey!\n');
  });

  test('A dart program fails', () async {
    await dartPubGet();
    final result = await dartRun(
      ['fail.dart'],
      expectedExitCode: 123,
      workingDirectory: 'example',
    );

    expect(result.stderr, 'My error.\n');
  });
}
1
likes
160
pub points
7%
popularity

Publisher

verified publisherainkin.com

Helpers and utilities for testing: running Dart processes and expecting output.

Repository (GitHub)
View/report issues

Topics

#testing #cli

Documentation

API reference

License

MIT-0 (license)

Dependencies

collection, test

More

Packages that depend on test_util