** Full webinar recording: https://youtu.be/D7vxFuwnUio **
Watch Sr. Architect Gil Tayar's special hands-on session, where he explains & demonstrates how Selenium and Cypress differ.
The session covers the following topics:
* How and why do frontend developers write tests
*Selenium architecture
*Cypress architecture
*Live Demo of Cypress - including how to write a Cypress test, and how it’s used
*How Cypress deals with flakiness
*Cypress and backdoors to development
*Visual Testing using Cypress
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
1. @giltayar
Cypress vs Selenium WebDriver:
Better, or just different?
Gil Tayar (@giltayar)
December 2019
Github repo: https://github.com/giltayar/cypress-vs-selenium
The presentation: http://bit.ly/cypress-vs-selenium-webinar
1
2. @giltayar@giltayar
About Me ● My developer experience goes all the way
back to the ‘80s.
● Am, was, and always will be a developer
● Testing the code I write is my passion
● Currently evangelist and architect @
Applitools
● We deliver Visual Testing tools:
If you’re serious about testing, checkout
Applitools Eyes
● Sometimes my arms bend back
● But the gum I like is coming back in style
@giltayar
22
4. @giltayar
The Talk is About
● What are Cypress and Selenium WebDriver?
● Why we should care?
● How are they different from each other?
and...
● Who wins?
4
28. @giltayar
Developers Testers
● We like fast
● We have access to the code
● We can test the application from
the inside
● Prefer unit & integration tests
● We ❤ JavaScript
● There are other browsers? 😉
● We’re OK with long suites of tests
● We don’t have access to the code
● We can test the application only
from the outside,
● So we MUST do mostly E2E tests
● We ❤ many languages
● So many browsers to test!
28
39. @giltayar
Because Selenium is a lot of I/O (Asynchronous)
39
Test with
WebDriver
Browser
Driver
Driver
Selenium
Protocol
Browser
Protocol
40. @giltayar
Because of the cross-everything and target audience
Pros
● Browser support: high
● Cross Language
● Test Runner: whatever you want
40
Cons
● Asynchronous (slower)
● Flaky unless handled
Target audience: testers.
● Grid support for running stuff in parallel (remember large slow suites?)
● Cross Browser is important
44. @giltayar
Cypress
● Started in 2015 by Brian Mann and Randall Kent
● More than just browser automation: a tool for frontend E2E testing
● Exact opposite of Selenium
● Commercial with open source freemium model
44
45. @giltayar
Cypress
● Started at 2015 by Brian Mann and Randall Kent
● More than just browser automation: a tool for frontend E2E testing
● Exact opposite of Selenium
● Open source with commercial additions
45
46. @giltayar
46
Selenium Cypress
Cross-browser Only Chrome
Cross language Only JavaScript
Cross test-runner Only Mocha
Slow(er) Fast
Target audience: testers Target audience: developers
Asynchronous Synchronous
Flaky Less flaky
Developer UX: none Developer UX: good
Mediocre docs Really good docs
Grid support Parallelism only in commercial offering
Good iFrame and Popup support Bad iFrame and popup support
49. @giltayar
Interactive Mode is Da
Bomb!
Developers don’t want
to spend time on E2E.
They don’t do it a lot
(remember pyramid?),
Need help building the
test.
49
65. @giltayar
Cypress Test Execution
Running the test only tells Cypress what to do
It remembers the actions, and then, when the test end,
executes the actions and assertions
65
66. @giltayar
So it’s difficult to do conditional tests
const element = cy.get('label')
if (element.text() === 'something') {
// do something
}
66
69. @giltayar
iFrames and Popups
● Does your app use iframes and popups!
● Buyer beware! Cypress does not support them
○ (although there are hacks around it)
● Why? Because the code runs in the browser...
69
77. @giltayar
Selenium Cypress
Cross-browser Only Chrome
Cross language Only JavaScript
Cross test-runner Only Mocha
Slow(er) Fast
Target audience: testers Target audience: developers
Asynchronous Synchronous
Flaky Less flaky
Developer UX: none Developer UX: good
Mediocre docs Really good docs
Grid support Parallelism only in commercial offering
Good iFrame and Popup support Bad iFrame and popup support
77
Which Do You
Choose?
78. @giltayar
● Must do Cross Browser Testing?
○ Is Visual Cross browser testing enough?
■ Yes: go with Cypress (with Applitools Visual Grid)
○ No: go with Selenium
● Run hundreds of tests?
○ Yes: Go with Selenium Grid or buy Cypress Commercial
○ No: Good. :-) Go with Cypress
● Are you a tester?
○ No: Go with Cypress
○ Yes: Dunno. Try Cypress, maybe you’ll like it
Decision Tree
78