Introduction to component testing

Our usual method of operation for doing anything Angular by now, is to use the Angular CLI. Working with tests is no different. The Angular CLI lets us create tests, debug them, and run them; it also gives us an understanding of how well our tests cover the code and its many scenarios. Let's have a quick look at how we can get going with some unit testing using the Angular CLI, and try to understand what is given to us by default.

If you want to code along with this chapter, you can either take an old Angular project and add tests to it or create a new standalone project, if you want to focus on practice testing only. The choice is yours.

If you opt for creating a new project, then type the following to scaffold ...

Get Learning Angular - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.