Top Banner
Adam Carmi (@carmiadam) Co-Founder and VP R&D at Applitools ADVANCED AUTOMATED VISUAL TESTING
51

Advanced Automated Visual Testing

Jan 08, 2017

Download

Software

adamcarmi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Advanced Automated Visual Testing

Adam Carmi (@carmiadam)Co-Founder and VP R&D at Applitools

ADVANCED AUTOMATED VISUAL

TESTING

Page 2: Advanced Automated Visual Testing

YOU CAN AND SHOULD

AUTOMATE YOUR VISUAL TESTS!

Page 3: Advanced Automated Visual Testing
Page 4: Advanced Automated Visual Testing

AGENDA

Why automated visual testing? Tools & Technology Where does it fit? Q & A

Page 5: Advanced Automated Visual Testing

WHAT IS VISUAL TESTING?

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

Page 6: Advanced Automated Visual Testing
Page 7: Advanced Automated Visual Testing
Page 8: Advanced Automated Visual Testing
Page 9: Advanced Automated Visual Testing

WHY AUTOMATE?

The test matrix is too big to cover manually Web browsers Devices Operating systems Screen resolutions Responsive design L10n 3rd Party upgrades

Page 10: Advanced Automated Visual Testing

WHY AUTOMATE?

Mobile apps quality is critical

Harder to roll back changes Can’t push daily

Updates take battery and data

Higher quality bar

Page 11: Advanced Automated Visual Testing

WHY AUTOMATE?

Release cycles keep getting shorter

Page 12: Advanced Automated Visual Testing

AGENDA

Why automated visual testing? Tools & Technology Where does it fit? Q & A

Page 13: Advanced Automated Visual Testing

HOW DOES IT WORK?

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 14: Advanced Automated Visual Testing

HOW DOES IT WORK?

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 15: Advanced Automated Visual Testing
Page 16: Advanced Automated Visual Testing
Page 17: Advanced Automated Visual Testing
Page 18: Advanced Automated Visual Testing
Page 19: Advanced Automated Visual Testing
Page 20: Advanced Automated Visual Testing
Page 21: Advanced Automated Visual Testing
Page 22: Advanced Automated Visual Testing
Page 23: Advanced Automated Visual Testing
Page 24: Advanced Automated Visual Testing

AND MORE… 1 pixel offsets in element positioning Dynamic content Moving elements Images of different size Performance

Page 25: Advanced Automated Visual Testing
Page 26: Advanced Automated Visual Testing

IMAGE COMPARISON APIS

Page 27: Advanced Automated Visual Testing

ImageMagick

A powerful command line tool for image processing.

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 28: Advanced Automated Visual Testing

THE JAVASCRIPT ENGINES Resemble.js

Pixel by pixel + error ratio + anti-aliasinghttp://huddle.github.io/Resemble.js

Blink-DiffPixel by pixel + error ratio + anti-aliasing + perceptual color distance computationhttps://github.com/yahoo/blink-diff

Looks-SamePixel by pixel + perceptual color distance computation + ignore Carethttps://github.com/gemini-testing/looks-same

Page 29: Advanced Automated Visual Testing

APPLITOOLS EYES Handles anti-aliasing, pixel offsets, color similarity, and image

scaling

Dynamic and moving content

Compare images of different sizes

No error ratio configuration required

Validates full UI pages

Fast!

Supports layout / structure matching

Page 30: Advanced Automated Visual Testing

DEMO

Page 31: Advanced Automated Visual Testing

HOW DOES IT WORK?

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 32: Advanced Automated Visual Testing

QUICK FEEDBACK TOOLS

MOTIVATION Get fast feedback on code changes

Run tests locally in the background

SETUP Render screenshots with a

headless browser PhatomJS, SlimerJS

Configuration file driven testsCONS Partial coverage

Chrome, IE?

Limited navigation

Tests stale browser versions

Page 33: Advanced Automated Visual Testing

VISUAL COVERAGE TOOLS

MOTIVATION Verify that the app / site looks

right in all real execution environments

Test as many UI states as possible

Execute many tests in parallel

SETUP Render screenshots using real

browsers on a variety of operating

systems and devices in parallel

WebDriver, Grid

Code driven tests

WebDriver, DSLCONS Requires test infrastructure

Implement and maintain test code

Page 34: Advanced Automated Visual Testing

Code / Script - WebDriverCSS

Page 35: Advanced Automated Visual Testing

Configuration - VIFF

Page 36: Advanced Automated Visual Testing

Manually – Applitools Eyes

Page 37: Advanced Automated Visual Testing

SAMPLE TOOLSCODE / SCRIPT● Needle (Python WD)● WebDriverCss (JS WebDriverIO)● Gemini (JS DSL)● Selenium Visual Diff (Java WD)● VisualCeption (PHP CodeCeption)● Pix-Diff (JS Protractor)● Shoov (JS WebDriverIO)● Vizregress (.NET WD)● Rspec Page Regression (Capibara)● Applitools Eyes (All WD + Appium)● PhantomCSS (JS CasperJS)● Specter (JS DSL)● FBSnapshotTestCase (XCTest)● Fighting Layout Bugs (Java WebDriver)● Huxley (Record Playback)

CONFIGURATION● Viff● CSS Visual Test● GreenOnion● Wraith-Selenium● Wraith● Dpdxt● Grunt PhotoBox● Grunt-Vigo● Snap And Compare● BackstopJS● CSSCritic● Kobold● DiffCop● SUCCSS

Page 38: Advanced Automated Visual Testing

SCREENSHOTS

Full page?

Regions?

Frames?

Device pixel ratio?

Rotation?

Viewport size?

Page preparation?

Page stabilization?

Page 39: Advanced Automated Visual Testing

HOW DOES IT WORK?

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 40: Advanced Automated Visual Testing

REPORT DIFFERENCESAs files on the file system

WebDriverCSS

Page 41: Advanced Automated Visual Testing

REPORT DIFFERENCESAs a gallery

Selenium Visual Diff

Page 42: Advanced Automated Visual Testing

HOW DOES IT WORK?

Drive the AUT and take screenshots

Compare screenshots with baseline images

Report differences

Update the baseline

Page 43: Advanced Automated Visual Testing

UPDATE THE BASELINE

Gemini

Page 44: Advanced Automated Visual Testing

DEMO

Page 45: Advanced Automated Visual Testing

AGENDA

Why automated visual testing? Tools & Technology Where does it fit? Q & A

Page 46: Advanced Automated Visual Testing

WHERE DOES IT FIT?

• Components

• Code review

• Developers

• Designers• QA

Visual testing of frontend components by frontend developers

Page 47: Advanced Automated Visual Testing

WHERE DOES IT FIT?

• Pages• Page

sections

• Developers

• Designers• QA• Others

Full or partial validation of application screensA collaboration tool

Page 48: Advanced Automated Visual Testing

WHERE DOES IT FIT?

• Staging vs. Production

• Ops• QA

Validate your staging deployment using your production deployment as a baseline

Page 49: Advanced Automated Visual Testing

WHERE DOES IT FIT?

• Monitoring

• Ops• QA

No missing resources in productionNo corruption due to 3rd party dataNo corruption due to browser / OS upgrades

Page 50: Advanced Automated Visual Testing

WHERE DOES IT FIT?

VISUAL FUNCTIONALVALIDATION

FULLCOVERAGE

LOWMAINTENANCE

Page 51: Advanced Automated Visual Testing

Adam Carmi (@carmiadam)Co-Founder and VP R&D at Applitools

QUESTIONS?