SlideShare a Scribd company logo
Visual Regression Testing
Charlie Owen
@sonniesedge
Visual Regression Testing
Testing things because things getting messy makes me twitchy and people don’t
like it when I get twitchy.
Robert K. Merton,
American sociologist
“The law of unintended consequences”
Web developer
“Oh fuck, I broke the build”
<p>Hello!</p>
p {
font-size: 2em;
}
Take initial screenshot
<p>Hello!</p>
p {
font-size: 4em;
}
Take second screenshot
✓
✕
Image diffing Image 1
What a cheat
Image diffing Image 2
Image diffing Differences in red
.btn-lg {
padding-right: 20px;
}
compare image1.png image2.png -compose src diff.png$>
PhantomCSS
Wraith
Grunt-photobox
Needle
SLIDE REMOVED DUE TO VIDEO SIZE
image of previous diff
Stephen Hay
“We’re not designing pages, we’re designing
systems of components.”
Component libraries
Charlie Owen
@sonniesedge
sonniesedge.co.uk

More Related Content

Recently uploaded

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Visual Regression Testing

Editor's Notes

  1. Thanks for introduction. As you heard, I’m Charlie Owen. .
  2. I’ve previously worked on sites such as the History Channel, purveyor of fine shows such as “Duck Dynasty” and “Storage Wars”
  3. and on the site for the AAT, A massive paid membership site for accountants. Actually exciting - one of the largest examples of Drupal in the world.
  4. I currently work at the BBC, where I’m building the site for the 2015 General Election. Believe me, that’s one deadline that we’re not allowed to ask for an extension on. Furthermore….
  5. …I’m a mess. I leave clothes on the floor, I leave dishes in the sink, and there are dust bunnies under my sofa. But when it comes to my workspace, I’m the polar opposite. 
  6. Anyone who has ever worked with me for some length of time will come to know my love of tidiness. I’m the one who keeps their desk perfectly clean, the one who lines up their pens in order, who strives for some utterly inhuman, uncluttered, ordered existence. 
  7. And it isn’t just my desk. My code is indented, separated away into folders, with modularised components. I love tests and order. My eye twitches when something breaks.
  8. Something like this would bug the hell out of me. Yes, I’m that person. It’s why I ended up learning about visual regression testing. 
  9. Perhaps this should be: Testing things because things getting messy makes me twitchy and people don’t like it when I get twitchy. Let’s back up, because I can sense that some of you are a bit confused.
  10. Because if you’re wondering what that is, don’t worry. Regression testing, let alone visual reg testing, isn’t something that we’re all familiar with. It’s probably a safe rule of thumb to suggest that the nearer you are to backend programming, the more you’re likely to have heard of it. And as this is frontend London, not Backend London, I guess I should explain what it is.  So, what’s a regression?
  11. I’m not talking about regression into a past life via hypnosis.
  12. It’s not Childhood regression. It’s not some Freudian desire to escape back to childhood.
  13. Nope, a regression is when there’s an unexpected fuckup. 
  14. - Let’s take an example. - Rabbits.  - Cute little things. The europeans took them over to Australia, they loved them so much. Wanted to keep them for egg-laying, or whatever it is that rabbits are kept for. But they started breeding like, well, rabbits.
  15. - Before long they’d eaten everything in Australia and had forced an evacuation of the continent.
  16. - That’s the law of unintended consequences, - In tech terms, a regression.  - You see regressions in tech all the time. Like when you get a software update for your computer, only for the wifi to stop working.
  17. Or when someone in your team commits a piece of code that stops the entire site from rendering.
  18. But you also see them in the frontend. Like when you change a piece of CSS in order to achieve an effect on a page, not realising that the same code is used on the about us page, and you’ve just made the CEO’s face 700% taller than it should be.  That’s a visual regression.
  19. “okay”, you’re thinking, “big deal. I check over all my pages when I make a change. I’ll see anything as stupid as that”. 
  20. But as your site grows, it gets more and more difficult to do stuff like that. It becomes a chore to check over 10 pages. Do it for 50 pages and you’re wasting half your day. Do it for a thousand pages, and well, that’s probably considered a cruel and unusual punishment by the UN. So what are you going to do? 
  21. Time to make the machines work for you. Because, frankly, they’re getting a bit uppity. Make them pay their way. Get them to start scanning for changes. Because machines are very good at doing small repetitive tasks like this. As well as throwing breeze blocks down the room.
  22. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  23. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  24. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  25. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  26. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  27. Principle is this: 1. Give a machine a chunk of HTML, styled up with CSS. 2. Let it take a screenshot. 3. Make a change to your CSS. 4. Get the machine to screenshot it again. 5. let the machine compare the two images. 6. If the images match, great. If they differ, then it’ll let you know.
  28. This actually works really well. Let’s have a simple test. Here’s a bootstrap demo page. I’m going to flick to the next slide and I want you to see if you can tell me where the difference is.
  29. Thing is, I’m not going to let you see that flick of difference. Let’s wait here a few seconds while you forget all the edges and boundaries of that previous slide. Ready?
  30. And here’s that image again. Who can tell me what the difference was? None of us. And that’s the problem.
  31. But the machine CAN see the difference. Here it is, sketched in red.
  32. All it was was 20px added to the .btn-lg class. It’s a classic visual regression. It’s something that an inexperienced developer (or tired, because I’ve done it) might do, in order to fix a problem on their page. Adding a bit of padding to a button, not realising that their CSS is unscoped and that the rules are bleeding into other selectors.
  33. And this is what I used to figure out the difference. The ImageMagick suite comes with a tool called Compare that… well, compares.
  34. But that’s just the start. Because there are suites of tools out there that will automate this entire process for you. You can script in Javascript, or use Selenium. You can list out all the pages that you want to test. PhantomCSS and Wraith are both ace.   WRITE LIST OF TOOLS ON SCREENS
  35. The fail popped up really quickly there, so let’s have a closer look at it. This, along with the command line warnings, make it really easy to see where something went wrong. This historical snapshot system isn’t the only way to do things, although many suites work on this basis. The BBC’s Wraith system, for example, can work by comparing two versions of a site, each running on a different git branch. Both techniques have their merit.
  36. So, all sorted? I can get off stage now? Well, maybe I made it seem easier than it actually is. Because this works if your pages are really simple. And you only have a few of them. And if your content never changes. Eh.
  37. You see, the more complex your pages become, the more chance that any two screenshots of them will differ, *even if you’ve not changed any CSS*. Because content changes. Navigation systems change. 3rd party widgets can change. Any of them differ and your screen shots no longer match, Take a look at the eBay homepage here. If we take a screenshot now, and another one in five seconds, they’re not going to match. the carousel on this page would cause the tests to fail
  38. Similarly, a facebook widget embedded on your homepage would cause the visual tests to fail. Because the content is constantly changing, page-based screenshot tests will fail.
  39. As would this loading spinner.
  40. You could ensure that nobody ever updates content on your site. Or never use animations. In fact just never change anything ever again, just so your test system works. Luckily we don’t have to be that stroppy. The answer is already there.
  41. Because…. Brad Frost.  Mr Atomic Design. He laid down the answer for us when he came up with component-based design.
  42. Rather than testing entire pages - volatile, mutable, changeable, pages - we start testing the *components* of a page.
  43. Brad Frost calls them atoms, molecules, organisms, I guess I’m talking about the equivalent of organism-level components here. whatever you want to call them, you start testing those fundamental elements, rather than entire complex pages.
  44. Instead of testing this….
  45. test this…
  46. and this…
  47. and this…
  48. and this…
  49. Fill these building block components with static dummy test data, and they shouldn’t change at all to your testing tool. The only time that they will is when you deliberately change it, or you break something.
  50. Having these component living by themselves is a bit fiddly. And, tbh, they get a bit lonely. So start grouping them together into a component library. Makes it easier to test each individual component if they’re all in one place.
  51. And it’s not just useful for testing. Putting all your components in one place is mega mega mega useful for other developers on your team. A site builder can look through here, see that there’s something useful, and plug it in to a data renderer of some kind.
  52. A quick side note: component libraries shouldn’t be confused with a visual style guide. A visual style guide is where your brand, UX and developers meet. It talks about how a user interacts with your site, rather than how your site is built. A visual style guide is built up from components taken from the component library. But it is something separate. A component library is for developers and testing.
  53. No, this is a component library. Great example here from twitter’s Bootstrap framework. You can build a component library manually. It’s pretty easy to do. Lay down an example of a styled component, and then add alongside a copy of the code used to generate it. Jekyll is pretty nifty for this. or you can use a tool like Hologram to search through your code and build up components automatically. 
  54. Any of the major tools out there will let you loop through the components in your library and test them. I like to keep components inside wrappers like this, so that they’re easily identifiable, both visually and in code.
  55. Keep the baseline snapshot for all your components in your git repo. your team members can then run tests on their machines and compare against these definitive versions. If they altered it *deliberately*, then they generate a new definite version and commit it to the repo, along with their changes.
  56. As always in these talks, I’ve got some caveats for you to bear in mind. Sometimes reality isn’t as great as the spiel.
  57. First of all, this simply isn’t cost effective for small projects. If you’re building a one off brochure-ware site for a company, this won’t help you.
  58. But if you’re building a medium to large-scale project, then this technique will pay dividends.
  59. Secondly, you ABSOLUTELY need to invest in component-driven design. If you design at the page-level, this just won’t work for you, for the reasons I mentioned. Again, component-driven development is a solution to a medium and large-scale problem.
  60. Lastly, be aware of what you’re testing. Many of these regression testing systems only work on one browser. It’s possible to introduce a browser-specific regression that will get past your tests. The more advanced selenium-based systems will let you do multibrowser testing, if you care to go for that.
  61. But despite these warnings, I think this is a technique that it’s massively worth investing time in. I know that the least fun part of my job is chasing these regressions, or hearing about them in tickets. Imagine how many hours are lost each week chasing these kinds of errors in large sites. Frankly, I think this technique is *indispensable*. 
  62. Please talk to me on twitter or email me if you’ve got further questions, and of course, come talk face to face.  Thank you. Have we got time for questions?