Use basic testing terminology
Identify parts of an Angular app
Discuss the differences between isolated tests and integrated tests and when to use each
Discuss deep vs. shallow testing
Write a unit test in Angular
An isolated test of the smallest unit of code
It should be fast, cheap to write, cover a single state change, assert one thing, avoid crossing process boundaries, and be reliable.
A behavior-driven development framework
Has many built-in utilities for testing
A lightweight server that loads and runs tests in browsers
Arrange - Act - Assert
Mocking is the mechanism of replacing a dependency with a fake piece of code that does less than the original.
Spies are test doubles. A spy can stub any function and tracks calls to it and all arguments.
=
Module
Module
Module
Component
Services
Component
=
+
+ ...
Module
Component
Class
=
+
Template
Metadata
+
app.module.ts
speaker-list.component.ts
meetup.service.ts
Isolated Test
Class only - no template
Constructed in test
Simple
Best for Services and Pipes
Integrated Test
Test class with template
Constructed by framework
More complex
Mainly used for components and directives
Class
Class
+
Template
Deep Tests
Test a component and all of its nested components, directives
Gives a better idea of how your app will actually run
Can be big and complicated and therefore more brittle
Shallow Tests
Testing utility that creates an Angular testing module—an @NgModule class—that you configure with the...
configureTestingModule()
...method to produce the module environment for the class you want to test
Class
Template
Metadata
Module
TestBed
E2E
Integration
Unit