Design for Tests: Best Practices
One of the best practices in a software project, be it a frontend or backend project, is testing. After all, if you and your team don’t rigorously test your system, the people who will inevitably test the system and find possible bugs are the users, and we don’t want that.
For this reason, it is no wonder that the Angular team has, since the first versions of the framework, been concerned with creating and integrating automated testing tools.
We can notice this with the fact that, by default, the Angular CLI always generates, together with the component, its test files as if saying, “Hey, buddy, don’t forget the unit test!”
In this chapter, we will explore this topic by covering the following:
- What to test
- Service tests
- Understanding
TestBed
- Component testing
- E2E tests with Cypress
At the end of the chapter, you will be able to create tests for your components and service, improving...