SlideShare a Scribd company logo
1 of 38
Download to read offline
SMILEY ROB | SENIOR IOS ENGINEER - JIRA | @rjchatfield
Inline Snapshot Testing
Effortless, Exhaustive, Expressive
Snapshot Testing
Images
Strings
First Principles
🤗 Inline 🤯
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
FBSnapshotVerifyView(view)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
FBSnapshotVerifyView(view)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
FBSnapshotVerifyView(view)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
FBSnapshotVerifyView(view)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
FBSnapshotVerifyView(view)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
assertSnapshot(matching: view, as: .image)
Inline Snapshot Testing - Rob Chatfield - Sydney Cocoaheads March 2019
assertSnapshot(matching: view, as: .image)
pointfree.co
assertSnapshot(matching: T, as: (T) -> Image)
pointfree.co
assertSnapshot(matching: T, as: (T) -> Image)
pointfree.co
assertSnapshot(matching: T, as: (T) -> Diffable)
pointfree.co
assertSnapshot(matching: T, as: (T) -> String)
pointfree.co
<JIRA.FabricRenderView; frame = (0 0; 1024 1024); gestureRecognizers = <NSArray>; layer = <CALayer>>
| <MobilekitEditor.ConcreteDocumentRendererNode-View; node = <MobilekitEditor.ConcreteDocumentRendererNode>; frame = (0 0; 1024 4706)>
| | <MobilekitEditor.CodeBlockNode-View; node = <MobilekitEditor.CodeBlockNode>; frame = (0 446.5; 1024 86)>
| | | <ASScrollView; baseClass = UIScrollView; frame = (8 8; 1008 70); clipsToBounds = YES; gestureRecognizers = <NSArray>>
| | | <UIImageView; frame = (557 64.5; 448 2.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer>>
| | | | <UIImageView; frame = (1002.5 3; 2.5 64); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer>>
| | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 537.5; 1024 688)>
| | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)>
| | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)>
| | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer)
| | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 1230.5; 1024 688)>
| | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)>
| | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)>
| | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer)
| | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 1923.5; 1024 688)>
| | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)>
| | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)>
| | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer)
| | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2616.5; 154.5 65.5)>
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 129.5 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 97.5 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "First list item">> (layer)
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 22.5; 154.5 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 122.5 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Second list item">> (layer)
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 45; 136 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 104 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Third list item">> (layer)
| | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2687; 154.5 65.5)>
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 129.5 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; 1.>; frame = (13 0; 12 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 97.5 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "First list item">> (layer)
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 22.5; 154.5 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; 2.>; frame = (10.5 0; 14.5 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 122.5 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Second list item">> (layer)
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 45; 136 20.5)>
| | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)>
| | | | | <ASTextNode-View; node = <ASTextNode; 3.>; frame = (10.5 0; 14.5 20.5); userInteractionEnabled = NO>
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 104 20.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Third list item">> (layer)
| | <MobilekitEditor.BlockquoteNode-View; node = <MobilekitEditor.BlockquoteNode>; frame = (0 2757.5; 1024 109.5)>
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 1024 109.5)>
| | | | <ASDisplayNode-Layer; node = <ASDisplayNode>> (layer)
| | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (4 0; 1020 109.5)>
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "All that is gold does not glitter, not all those w…">> (layer)
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "From the ashes a fire shall be woken, a light from…">> (layer)
| | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "J.R.R. Tolkien, The Fellowship of the Ring.">> (layer)
| | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2872; 302.5 38)>
| | | <MobilekitEditor.PanelIcon-Layer; node = <MobilekitEditor.PanelIcon>> (layer)
| | | | <ASImageNode-Layer; node = <ASImageNode>> (layer)
| | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 8; 262.5 20.5)>
assertSnapshot(matching: T, as: (T) -> String)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
assertSnapshot(matching: view, as: .image)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let view = MyView()
view.update(foo: “foo string”)
assertSnapshot(matching: view, as: .image)
assertSnapshot(matching: view, as: .recursiveDescription)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
let str = makeDescription(of: object)
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
let str = makeDescription(of: object)
XCTAssertEqual(str, )
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
let str = makeDescription(of: object)
XCTAssertEqual(str, """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
let str = makeDescription(of: object)
XCTAssertEqual(str, """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: makeDescription, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: makeDescription, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: makeDescription, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: makeDescription, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: .dump, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: .dump, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: .dump, is: """
â–ż MyObject
- foo: "foo string"
""")
Snapshot
Testing
Images
Strings
First Principles
🤗 Inline 🤯
let object = MyObject()
object.update(foo: “foo string”)
assertSnapshot(of: object, as: .dump, is: """
â–ż MyObject
- foo: "foo string"
""")
SAY SNAPSHOT
ONE MORE
TIME
Demo
bitbucket.org/rjchatfield/InlineSnapshotTesting
SMILEY ROB | SENIOR IOS ENGINEER - JIRA | @rjchatfield
Thank you
bitbucket.org/rjchatfield/InlineSnapshotTesting

More Related Content

Recently uploaded

The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1Jamie (Taka) Wang
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine visionJamie (Taka) Wang
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 

Recently uploaded (20)

The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 

Featured

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
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
 
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
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slidesAlireza Esmikhani
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

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
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Inline Snapshot Testing - Rob Chatfield - Sydney Cocoaheads March 2019

  • 1. SMILEY ROB | SENIOR IOS ENGINEER - JIRA | @rjchatfield Inline Snapshot Testing Effortless, Exhaustive, Expressive
  • 5. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”)
  • 6. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) FBSnapshotVerifyView(view)
  • 7. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) FBSnapshotVerifyView(view)
  • 8. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) FBSnapshotVerifyView(view)
  • 9. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) FBSnapshotVerifyView(view)
  • 10. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) FBSnapshotVerifyView(view)
  • 11. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) assertSnapshot(matching: view, as: .image)
  • 13. assertSnapshot(matching: view, as: .image) pointfree.co
  • 14. assertSnapshot(matching: T, as: (T) -> Image) pointfree.co
  • 15. assertSnapshot(matching: T, as: (T) -> Image) pointfree.co
  • 16. assertSnapshot(matching: T, as: (T) -> Diffable) pointfree.co
  • 17. assertSnapshot(matching: T, as: (T) -> String) pointfree.co
  • 18. <JIRA.FabricRenderView; frame = (0 0; 1024 1024); gestureRecognizers = <NSArray>; layer = <CALayer>> | <MobilekitEditor.ConcreteDocumentRendererNode-View; node = <MobilekitEditor.ConcreteDocumentRendererNode>; frame = (0 0; 1024 4706)> | | <MobilekitEditor.CodeBlockNode-View; node = <MobilekitEditor.CodeBlockNode>; frame = (0 446.5; 1024 86)> | | | <ASScrollView; baseClass = UIScrollView; frame = (8 8; 1008 70); clipsToBounds = YES; gestureRecognizers = <NSArray>> | | | <UIImageView; frame = (557 64.5; 448 2.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer>> | | | | <UIImageView; frame = (1002.5 3; 2.5 64); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer>> | | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 537.5; 1024 688)> | | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)> | | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)> | | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer) | | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 1230.5; 1024 688)> | | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)> | | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)> | | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer) | | <MobilekitEditor.MediaRendererNode-View; node = <MobilekitEditor.MediaRendererNode>; frame = (0 1923.5; 1024 688)> | | | <MobilekitEditor.MediaNotAvailableNode-View; node = <MobilekitEditor.MediaNotAvailableNode>; frame = (0 5; 1024 683)> | | | | <ASButtonNode-View; node = <ASButtonNode>; frame = (0 0; 1024 683)> | | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer) | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2616.5; 154.5 65.5)> | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 129.5 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 97.5 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "First list item">> (layer) | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 22.5; 154.5 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 122.5 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Second list item">> (layer) | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 45; 136 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; •>; frame = (17.5 0; 7.5 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 104 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Third list item">> (layer) | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2687; 154.5 65.5)> | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 129.5 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; 1.>; frame = (13 0; 12 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 97.5 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "First list item">> (layer) | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 22.5; 154.5 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; 2.>; frame = (10.5 0; 14.5 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 122.5 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Second list item">> (layer) | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 45; 136 20.5)> | | | | <MobilekitEditor.BulletNode-View; node = <MobilekitEditor.BulletNode>; frame = (0 0; 30 20.5)> | | | | | <ASTextNode-View; node = <ASTextNode; 3.>; frame = (10.5 0; 14.5 20.5); userInteractionEnabled = NO> | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 0; 104 20.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "Third list item">> (layer) | | <MobilekitEditor.BlockquoteNode-View; node = <MobilekitEditor.BlockquoteNode>; frame = (0 2757.5; 1024 109.5)> | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 0; 1024 109.5)> | | | | <ASDisplayNode-Layer; node = <ASDisplayNode>> (layer) | | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (4 0; 1020 109.5)> | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "All that is gold does not glitter, not all those w…">> (layer) | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "From the ashes a fire shall be woken, a light from…">> (layer) | | | | | <MobilekitEditor.TappableTextNode-Layer; node = <MobilekitEditor.TappableTextNode; "J.R.R. Tolkien, The Fellowship of the Ring.">> (layer) | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (0 2872; 302.5 38)> | | | <MobilekitEditor.PanelIcon-Layer; node = <MobilekitEditor.PanelIcon>> (layer) | | | | <ASImageNode-Layer; node = <ASImageNode>> (layer) | | | <MobilekitEditor.StackContainer-View; node = <MobilekitEditor.StackContainer>; frame = (32 8; 262.5 20.5)> assertSnapshot(matching: T, as: (T) -> String)
  • 19. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) assertSnapshot(matching: view, as: .image)
  • 20. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let view = MyView() view.update(foo: “foo string”) assertSnapshot(matching: view, as: .image) assertSnapshot(matching: view, as: .recursiveDescription)
  • 23. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”)
  • 24. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) let str = makeDescription(of: object)
  • 25. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) let str = makeDescription(of: object) XCTAssertEqual(str, )
  • 26. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) let str = makeDescription(of: object) XCTAssertEqual(str, """ â–ż MyObject - foo: "foo string" """)
  • 27. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) let str = makeDescription(of: object) XCTAssertEqual(str, """ â–ż MyObject - foo: "foo string" """)
  • 28. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: makeDescription, is: """ â–ż MyObject - foo: "foo string" """)
  • 29. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: makeDescription, is: """ â–ż MyObject - foo: "foo string" """)
  • 30. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: makeDescription, is: """ â–ż MyObject - foo: "foo string" """)
  • 31. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: makeDescription, is: """ â–ż MyObject - foo: "foo string" """)
  • 32. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: .dump, is: """ â–ż MyObject - foo: "foo string" """)
  • 33. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: .dump, is: """ â–ż MyObject - foo: "foo string" """)
  • 34. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: .dump, is: """ â–ż MyObject - foo: "foo string" """)
  • 35. Snapshot Testing Images Strings First Principles 🤗 Inline 🤯 let object = MyObject() object.update(foo: “foo string”) assertSnapshot(of: object, as: .dump, is: """ â–ż MyObject - foo: "foo string" """)
  • 38. SMILEY ROB | SENIOR IOS ENGINEER - JIRA | @rjchatfield Thank you bitbucket.org/rjchatfield/InlineSnapshotTesting