Two web app testing approaches: 1
Two web app testing approaches:
1. Emulated. (Typically via @jestjs_ or @vitest_dev with jsdom or happy-dom)
2. Real browser. (Typically via @playwrightweb or @Cypress_io).
Here are the tradeoffs:
Emulated:
✅ Typically faster since it avoids overhead of running a full browser.
🚩 It's fake, so may not behave like the browser.
🚩 It's incomplete. Only mimics a subset of the browser's features.
🚩 It's harder to debug failing tests. We can't watch the test run in a real browser.
🚩 Not ideal for end-to-end testing, since it doesn't run in a real browser. So team needs to learn and support both emulated and real browser testing tools.
Real browser:
✅ Easy to debug. Can "see" the test run in the browser.
✅ It's real. We have more confidence and power when our test runs in a real browser.
✅ Team can use one testing tool for all tests (e2e, integration, single component, etc).
🚩 It's typically slower than emulated since running a real browser adds overhead.
Any other tradeoffs you've noticed?