Component Testing (DRAFT) 4.0


If you notice any issues with this page, please report them.

This part of the Testing how-to guide covers component testing of AngularDart apps using these packages:

  • package:test, Dart’s standard testing package, which is similar to most unit testing frameworks, including Jasmine for JavaScript. If you’ve used a modern testing framework before, then writing tests using package:test will have a familiar feel. Testing basics is covered in Writing component tests: Basics. For in-depth coverage of the package capabilities, see the package:test documentation.

  • package:angular_test, which complements the standard test package by providing a means of interacting with Angular components created as test fixtures.

  • package:mockito, a library for creating mock objects. Not all component tests require mock objects, but in later sections, you’ll learn the fundamentals of using package:mockito as needed — for complete details consult the package documentation.

Scope

The angular_test package is suitable for testing either a single component, or a small group of related components. It is not meant to test an entire app. For that, you’ll write end-to-end tests.

angular_test will report errors if you attempt to test an app root component with an associated router. See Which routing components can I test? for details.

Topics

These are the component testing topics covered in this guide: