Whether you’ve just started the tutorial, or
finished the Get Started page,
you are ready to run your first tests!
If you haven’t worked through these projects recently, don’t worry.
You can follow along by first setting up the
tutorial’s Starter App.
The tutorial’s Starter App
includes a few basic tests for its AppComponent in the following test file:
To run tests, open a terminal, and from the project root issue the following
pub run angular_test --test-arg=--tags=aot --test-arg=--platform=dartium --test-arg=--reporter=expanded
The --reporter argument is optional, but using it results in more compact output.
The test framework runs code transformers, launches pub serve, loads
the test file, and runs tests:
The pub serve output is at .../angular_test_pub_serve_output.log.
Run with --verbose to get this output in the console instead.
pub serve test --port=0
Pub "serve" started on http://localhost:58042
Finished compilation. Running tests...
pub run test --tags=aot --platform=dartium --reporter=expanded --pub-serve=58042
00:00 +0: test/app_test.dart: Default greeting
00:00 +1: test/app_test.dart: Greet world
00:00 +2: test/app_test.dart: Greet world HTML
00:00 +3: All tests passed!
As mentioned in the command output, you can use --verbose to direct pub serve output
directly to the console rather than to a log file. This can be more convenient when