Testing infrastructure and runner for AngularDart.


angular_test is both a framework for writing tests for AngularDart components and a test runner that delegates to both pub serve and pub run test to run component tests using the AOT-compiler - angular_test does not function in reflective mode.

Example use:

@Tags(const ['aot'])
import 'dart:html';

import 'package:angular2/angular2.dart';
import 'package:angular_test/angular_test.dart';
import 'package:test/test.dart';

void main() {

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

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

You will need to also configure in pubspec.yaml to run code generation:

  # Run the code generator on the entire package.
  - angular2/transform/codegen

  # Run the reflection remover on tests that have AoT enabled.
  - angular2/transform/reflection_remover:
          - test/test_using_angular_test.dart

  # Allow test to proxy-load files so we can run AoT tests w/ pub serve.
  - test/pub_serve:
      $include: test/**_test.dart


Use pub run angular_test - it will automatically run pub serve to run code generation (transformers) and pub run test to run browser tests on anything tagged with 'aot'.:

$ pub run angular_test




Additional API to be used when migrating existing code to angular_test.