Angular Component Test Harnesses FTW - Alisa Duncan - NG-BE 2023

preview_player
Показать описание
Do you want component unit tests that are easier to write and maintain - tests that don’t have to always query the template? This is possible when you use Angular CDK's test harnesses.

In this talk, we'll cover different types of testing methods, what test harnesses are, using Angular Material component test harnesses for immediate results, and how you can extend the CDK `ComponentHarness` to create custom component test harnesses. With the power of testing harnesses, you'll be able to write winning tests.

More info:
Рекомендации по теме
Комментарии
Автор

Shout-outs to the Angular material-team for making our life easier! Loved this talk Alisa! 😎

markusingvarsson
Автор

I've been using test harnesses since they were inbtroduced and for unit tests, these have been a great boon. There are two points that continue to bother me daily:

1. The async test harness API won't win a prize for ergonomics, I routinly extract calls nested five layers deep into functions in order to do something banal, like triggering a mat-tooltip and getting its value.
2. Anemic story for harnesses outside of unit test. My E2E tests leverage TestCafe and instead of re-using existing harnesses, I have to write my own harnesses in compatible format. These are always much simpler to use, though thanks to the fuild chainable `TestController` API.

Klaster_