SlideShare uma empresa Scribd logo
1 de 62
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

Mais conteúdo relacionado

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Destaque

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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil 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 2024Albert 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 InsightsKurio // 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 2024Search 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 summarySpeakerHub
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit 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 managementMindGenius
 
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 WorkGetSmarter
 

Destaque (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

Notas do Editor

  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?