advanced visual test automation with selenium

49
Adam Carmi (@carmiadam) Co-Founder and VP R&D at Applitools [email protected] ADVANCED VISUAL TEST AUTOMATION WITH SELENIUM

Upload: adamcarmi

Post on 17-Jul-2015

378 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Advanced Visual Test Automation With Selenium

Adam Carmi (@carmiadam)

Co-Founder and VP R&D at Applitools

[email protected]

ADVANCED VISUAL TEST AUTOMATION WITH

SELENIUM

Page 2: Advanced Visual Test Automation With Selenium

YOU CAN AND SHOULD

AUTOMATE YOUR

VISUAL TESTS!

Page 3: Advanced Visual Test Automation With Selenium
Page 4: Advanced Visual Test Automation With Selenium

AGENDA

Why automated visual testing?

Tools & Technology

Where does it fit?

Page 5: Advanced Visual Test Automation With Selenium

WHAT IS VISUAL TESTING?

A quality assurance activity aimed to verify that a Graphical User Interface appears correctly to users

Page 6: Advanced Visual Test Automation With Selenium

A VISUAL BUG

Page 7: Advanced Visual Test Automation With Selenium

AND ANOTHER…

Page 8: Advanced Visual Test Automation With Selenium

WHY SHOULD IT BE AUTOMATED?

THE TEST MATRIX IS TOO BIG TO APPROXIMATE MANUALLY Web browsers Devices Operating systems Screen resolutions Responsive designs L10n

Page 9: Advanced Visual Test Automation With Selenium

WHY SHOULD IT BE AUTOMATED?

Page 10: Advanced Visual Test Automation With Selenium

WHY SHOULD IT BE AUTOMATED?

NATIVE / HYBRID MOBILE APPS Harder to roll back changes

Can’t push daily

Updates take battery and data

Higher quality bar

Page 11: Advanced Visual Test Automation With Selenium

WHY SHOULD IT BE AUTOMATED?

Many are already doing it (and sharing)…

PhantomCSSFighting Layout Bugs

CSS Critc Wraith

Needle

Grunt PhotoBox

dpdxt

WebdriverCSS

EyesHuxley

FBSnapshotTestCase

GeminiSelenium Visual Diff

VisualCeption

Specter

Snap And Compare

kobold

Page 12: Advanced Visual Test Automation With Selenium

AGENDA

Why automated visual testing?

Tools & Technology

Where does it fit?

Page 13: Advanced Visual Test Automation With Selenium

THE WORKFLOW

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 14: Advanced Visual Test Automation With Selenium

DEMOhttps://github.com/webdriverio/webdrivercss

Page 15: Advanced Visual Test Automation With Selenium

THE WORKFLOW

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 16: Advanced Visual Test Automation With Selenium

DRIVING AND CAPTURING

OTHER

• Wraith (URLs)

• PhantomCSS (CJS)

• dpdxt (URLs)

• Grunt PhotoBox (URLs)

• Snap And Compare

(URLs)

• Specter (JS)

• Gemini (JS)

• Grunt-Vigo (URLs)

• WebDriverCSS (JS)

• Fighting Layout Bugs

(Java)

• Wraith-Selenium (Ruby)

• Selenium Visual Diff

(Java)

• Needle (Python)

• VisualCeption (PHP)

• Huxley (RP)

• Gemini (JS)

• Vizregress (.NET)

• Visualci (Java)

• Viff (JS)

• Pix-Diff (JS)

• Applitools Eyes (All)

• CSS Critic (URLs)

• FBSnapshotTestCa

se (XCTest)

• Kobold (folders)

• Applitools Eyes

(All)

Page 17: Advanced Visual Test Automation With Selenium

SCREENSHOTS

Real browsers? Full page? Frames? Regions? Viewport size? Page stabilization? Page preparation?

Page 18: Advanced Visual Test Automation With Selenium

THE WORKFLOW

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 19: Advanced Visual Test Automation With Selenium
Page 20: Advanced Visual Test Automation With Selenium

WHY NOT?

FALSE POSITIVES

Page 21: Advanced Visual Test Automation With Selenium

ANTI ALIASING 1/2

Page 22: Advanced Visual Test Automation With Selenium

ANTI ALIASING 2/2

Page 23: Advanced Visual Test Automation With Selenium

BRIGHTNESS 1/2

Page 24: Advanced Visual Test Automation With Selenium

BRIGHTNESS 2/2

Page 25: Advanced Visual Test Automation With Selenium

SUB PIXEL SHIFTS 1/2

Page 26: Advanced Visual Test Automation With Selenium

SUB PIXEL SHIFTS 2/2

Page 27: Advanced Visual Test Automation With Selenium

IMAGE SCALING 1/2

Page 28: Advanced Visual Test Automation With Selenium

IMAGE SCALING 2/2

Page 29: Advanced Visual Test Automation With Selenium

ANDMORE…

1 pixel offsets in element positioning

Dynamic content

Moving elements

Images of different size

Performance

Page 30: Advanced Visual Test Automation With Selenium
Page 31: Advanced Visual Test Automation With Selenium

Image Comparison APIs

Page 32: Advanced Visual Test Automation With Selenium

ImageMagick A powerful command line tool for image processing. APIs are available for most programming languages. Fuzzing is used to eliminate slight color differences An error ratio is usually used to determine a match

$ compare –metric AE –fuzz 5% img1.png img2.png diff.png

2246

Page 33: Advanced Visual Test Automation With Selenium

Resemble.js An image comparison library implemented in Javascript

Used by PhantomCSS and other tools.

Good antialiasing support

An error ratio is usually used to determine a match

http://huddle.github.io/Resemble.js/

Page 34: Advanced Visual Test Automation With Selenium

Blink-Diff An image comparison library implemented in Javascript

Can be operated from the command line using node

Perceptual color distance computation

Anti-aliasing support

An error ratio is used to determine a match

https://github.com/yahoo/blink-diff/

Page 35: Advanced Visual Test Automation With Selenium

Applitools Eyes A specialized image processing stack designed to compare

computer generated UI images

Anti-aliasing, pixel offsets, and image scaling with low false negative rate

Dynamic and moving content

Compare images of different sizes

No error ratio configuration required

Fast!

Layout matching

Available as a cloud service

Page 36: Advanced Visual Test Automation With Selenium

DEMO

Page 37: Advanced Visual Test Automation With Selenium

THE WORKFLOW

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 38: Advanced Visual Test Automation With Selenium

REPORT DIFFERENCESAs files on the file system (combined with source control)

Page 39: Advanced Visual Test Automation With Selenium

REPORT DIFFERENCESAs a Gallery (example from Selenium Visual Diff)

Page 40: Advanced Visual Test Automation With Selenium

THE WORKFLOW

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 41: Advanced Visual Test Automation With Selenium

UPDATE THE BASELINE

Rename or commit individual image files

Overwrite mode

Page 42: Advanced Visual Test Automation With Selenium

UPDATE THE BASELINE

GUI (Gemini GUI)

Automatic maintenance (Applitools Eyes)

Page 43: Advanced Visual Test Automation With Selenium

AGENDA

Why automated visual testing?

Tools & Technology

Where does it fit?

Page 44: Advanced Visual Test Automation With Selenium

WHERE DOES IT FIT?

• Component

s

• Code

review

• Developers

• Designers

• QA

Page 45: Advanced Visual Test Automation With Selenium

WHERE DOES IT FIT?

• Pages

• Page

sections

• Developers

• Designers

• QA

• Others

Page 46: Advanced Visual Test Automation With Selenium

WHERE DOES IT FIT?

• Staging vs.

Production

• Ops

• QA

Page 47: Advanced Visual Test Automation With Selenium

WHERE DOES IT FIT?

• Monitoring

• Ops

• QA

Page 48: Advanced Visual Test Automation With Selenium

QUESTIONS?

Page 49: Advanced Visual Test Automation With Selenium

Adam Carmi (@carmiadam)

Co-Founder and VP R&D at Applitools

[email protected]

THANK YOU