Angular Component Test Harnesses FTW
summary
Claims that using Angular CDK's test harnesses makes component unit tests simpler and more resilient, demonstrates built-in harnesses for Angular Material controls (available since Angular v12) and shows a custom harness for an app add comment component that is tested via TestbedHarnessEnvironment.loader and harness predicates. Examples use Karma unit tests, show the harness API (e.g. MatInputHarness setValue/getValue, locatorFor/locatorForAll), and report harness-based tests surviving the Angular v15 MDC changes.
AI-written summary · about
chapters (6)
- 0:00The challenge of UI testing
- 2:34Understanding test harnesses
- 4:49Harnesses in action
- 8:46CDK testing API mechanics
- 13:45Writing custom harnesses
- 20:17Best practices and conclusion
related talks
28mAngular Component Test Harnesses FTW
28mTesting with Component Harnesses for the Win
16mAngular components - unit testing
56mAngular Unit Testing from the Trenches
13mTesting Angular Components Fundamentals
59mTechniques and practices for testing Angular 2
52mAngular Testing: Do I Really Have to Do It?!
19mTesting Best Practices for Angular Applications
