angular_test 2.0.0-alpha+7
angular_test: ^2.0.0-alpha+7

outdated Dart 2 incompatible

Testing runner and library for AngularDart

angular_test #

Pub package

Testing infrastructure AngularDart, used with the build_runner package.

Documentation and examples:

NOTE: Some of the guides above are out of date the for the latest angular_test versions.

Additional resources:

Overview #

angular_test is a library for writing tests for AngularDart components.

// Assume this is 'my_test.dart'.
import 'my_test.template.dart' as ng;

void main() {

  test('should render "Hello World"', () async {
    final testBed = new NgTestBed<HelloWorldComponent>();
    final testFixture = await testBed.create();
    expect(testFixture.text, 'Hello World');
    await testFixture.update((c) => = 'Universe');
    expect(testFixture.text, 'Hello Universe');

@Component(selector: 'test', template: 'Hello {{name}}')
class HelloWorldComponent {
  String name = 'World';

To use angular_test, configure your package's pubspec.yaml as follows:

  build_runner: ^0.7.9
  build_test: ^0.10.0
  build_web_compilers: ^0.3.0

IMPORTANT: angular_test will not run without these dependencies set.

To run tests, use pub run build_runner test. It automatically compiles your templates and annotations with AngularDart, and then compiles all of the Dart code to JavaScript in order to run browser tests. Here's an example of using Chrome with Dartdevc:

pub run build_runner test -- -p chrome

For more information using pub run build_runner test, see the documentation: