Why should the UI test automation suite be small compared to unit tests?
Options
- UI tests are slow and brittle, so keep only a few (Correct option)
- UI tests are free to maintain, so write many more
- Unit tests cannot find real bugs in the logic
- Browsers are very fast, so UI tests are cheap
Answer
UI tests are slow, brittle and expensive to maintain, so keep a few critical end-to-end flows and test most logic at lower levels (the test pyramid)
Why
Test pyramid: many unit tests (fast, cheap), fewer integration tests, very few UI/E2E tests (slow, depend on browsers, network, data).
Use UI automation for the most important user journeys (login, purchase) and smoke tests after deployment.
Test business rules, validation and edge cases through unit or API tests.
Remember
Few UI tests, many unit tests.