Click here to see an updated version of this tutorial that's been upgraded for Angular 2.0 RC1.
This article is the second in a series about learning Angular 2. It describes how to test a simple Angular 2 application. In a previous article, Getting Started with Angular 2, I showed how to develop a simple search and edit feature. In this tutorial, I did my best to keep the tests similar to last year's Testing AngularJS Applications so you can compare the code between AngularJS and Angular 2.
What you'll build
You'll learn to use Jasmine for unit testing controllers and Protractor for integration testing. Angular's documentation has a good guide to unit testing if you'd like more information on testing and why it's important.
The best reason for writing tests is to automate your testing. Without tests, you'll likely be testing manually. This manual testing will take longer and longer as your codebase grows.
What you'll need
Get the tutorial project
Clone the angular2-tutorial repository using git and install its dependencies.
git clone https://github.com/mraible/angular2-tutorial.git cd angular2-tutorial npm install