...

/

Testing Components

Testing Components

Learn more techniques for testing components

Many Angular components will include child components in their HTML template. There are two ways to test these components; we can write a shallow render, where we ignore the child components, or a deep render, where we render the child components. This is similar to the distinction between a unit test and an integration test. Mostly, we want to test a component in isolation, ignoring the child components.

We might also write a few deep render tests to make sure that the components work correctly when we combine them. We can write a shallow render test by adding NO_ERRORS_SCHEMA to the TestBed configuration.

Shallow render tests

Suppose we have SignUpComponent that has ...