build_test 0.9.3
build_test: ^0.9.3 copied to clipboard

outdated Dart 2 incompatible

Utilities for writing unit tests of Builders.

build_test #

Testing utilities for users of package:build.
Build Status Issues related to build_test Pub Package Version Latest Dartdocs Join the chat on Gitter

Installation #

This package is intended to only be as a development dependency for users of package:build, and should not be used in any production code. Simply add to your pubspec.yaml:


Usage #

See the test folder in the build package for more examples.

Resolve source code for testing #

Using resolveAsset and resolveSource, you can resolve Dart source code into a static element model, suitable for probing and using within tests of code you might have written for a Builder:

test('should resolve a simple dart file', () async {
  var resolver = await resolveSource(r'''
    library example;

    class Foo {}
  var libExample = resolver.getLibraryByName('example');
  expect(libExample.getType('Foo'), isNotNull);

Run a Builder within a test environment #

Using testBuilder, you can run a functional test of a Builder, including feeding specific assets, and more. It automatically creates an in-memory representation of various utility classes.

Various test implementations of classes #