Component testing

E2E

(UI)

Integration

Unit

Critical user flow testing

Render checks + Edge case testing

Isolated testing

Component based

App

Feature

Not all components are created equal!

Smart

  • Feature

  • Service access

  • Controls state

  • App specific

  • Dumb children

  • Deep test

Smart

Dumb

Dumb

Dumb

Dumb

Dumb

  • Piece of UI

  • No service access

  • No state

  • Portable/reusable

  • Dumb children

  • Shallow test

Service

Data

Data

Event

Event

Smart vs Dumb

Shallow test

  • Mock children
  • Test UI based on input
  • Test child event handlers
  • Test event emitting

Dumb

Dumb

Dumb

Data

Event

Event

Demo

Demo

NgMocks

Demo

What's next?

  • Documentation
  • +- 40 Spectator tests:
    `angular/libs/global-sites`
  • Start shallow testing today!
  • Deep testing coming soon...

Questions

Spectator

By rachnerd

Spectator

  • 149