What is the difference between unit, integration and end-to-end tests?
Model answer
A unit test checks one small piece, such as a function or service, in isolation. An integration test checks that several parts work together, for example a component with its template and a fake service. An end-to-end (e2e) test drives the real app in a browser, clicking and typing like a user, with tools such as Playwright or Cypress.
Have many fast unit tests, fewer integration tests, and a small set of e2e tests for key journeys such as login and checkout.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.
More questions
- How do you write a unit test for a component or a service in Angular?
- How do you test a component that calls an API?
- How do you test route guards, pipes and directives?
- What does ng lint and a formatter give you, and what other tooling do Angular teams use?
- How do you handle environment-specific settings in Angular?
- How would you structure a large Angular application?