Slide 1

Slide 1 text

VISUAL TESTING A COMMUNICATION PROBLEM 1 — @basthomas

Slide 2

Slide 2 text

COMMUNICATION IS HARD 2 — @basthomas

Slide 3

Slide 3 text

SNAPSHOT TESTING 3 — @basthomas

Slide 4

Slide 4 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 4 — @basthomas

Slide 5

Slide 5 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 5 — @basthomas

Slide 6

Slide 6 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 6 — @basthomas

Slide 7

Slide 7 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 7 — @basthomas

Slide 8

Slide 8 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 8 — @basthomas

Slide 9

Slide 9 text

func testViewWithSecondaryInteraction() { let viewUnderTest = InteractionBarView() let primaryInteractions: [Interaction] = [.recommend, .comment, .like] let secondaryInteractions: [Interaction] = [.report] viewUnderTest.setup( withInteractions: primaryInteractions, secondaryInteractions: secondaryInteractions ) validateSnapshots(forView: viewUnderTest) } 9 — @basthomas

Slide 10

Slide 10 text

10 — @basthomas

Slide 11

Slide 11 text

WHAT IF THE DESIGN CHANGES? 11 — @basthomas

Slide 12

Slide 12 text

WHAT IF ONE OF THE PRIMARY INTERACTIONS CHANGES? 12 — @basthomas

Slide 13

Slide 13 text

! 13 — @basthomas

Slide 14

Slide 14 text

IT IS EASY TO MAKE A MISTAKE 14 — @basthomas

Slide 15

Slide 15 text

NAMING IS HARD 15 — @basthomas

Slide 16

Slide 16 text

NAMING IS HARD > testCellWithPageControlOnPage2of3 > testCellWithLongNameAndJob > testWithShortContent > testTwoBirthdaysUnseenElement > testStateLoadMoreFailedInsertedOnTop > testSlideupViewWithNoIconNoButton 16 — @basthomas

Slide 17

Slide 17 text

DO YOU HAVE ANY IDEA WHAT IT IS WE'RE TESTING HERE? 17 — @basthomas

Slide 18

Slide 18 text

... MAYBE? 18 — @basthomas

Slide 19

Slide 19 text

DO YOU HAVE ANY IDEA WHEN THESE TESTS ARE EXPECTEDLY FAILING? 19 — @basthomas

Slide 20

Slide 20 text

ME NEITHER 20 — @basthomas

Slide 21

Slide 21 text

A FAILING SNAPSHOT TEST 21 — @basthomas

Slide 22

Slide 22 text

22 — @basthomas

Slide 23

Slide 23 text

testCellWithPageControlOnPage2of3 SO, IT SHOULDN'T BE 23 — @basthomas

Slide 24

Slide 24 text

! 24 — @basthomas

Slide 25

Slide 25 text

REPLACEABLE BY UNIT TESTS 25 — @basthomas

Slide 26

Slide 26 text

SNAPSHOTS AT SCALE 26 — @basthomas

Slide 27

Slide 27 text

WE MADE IT HARDER ON OURSELVES FORK, WRAPPER, WRAPPER, WRAPPER 27 — @basthomas

Slide 28

Slide 28 text

DOCUMENT DECISIONS 28 — @basthomas

Slide 29

Slide 29 text

MULTIPLE SIMULATORS 29 — @basthomas

Slide 30

Slide 30 text

SPACE 30 — @basthomas

Slide 31

Slide 31 text

IDE UPDATES 31 — @basthomas

Slide 32

Slide 32 text

! 32 — @basthomas

Slide 33

Slide 33 text

!"!"!"!"! !"!"!"!"! !"!"!"!"! !"!"!"!"! !"!"!"!"! 33 — @basthomas

Slide 34

Slide 34 text

SNAPSHOTS ARE SUBJECTIVE 34 — @basthomas

Slide 35

Slide 35 text

IT IS NOT ALL BAD 35 — @basthomas

Slide 36

Slide 36 text

QUESTION THINGS > "but I just copied it" > "but others are doing it" > "but I can't write a unit test here" > "but ..." 36 — @basthomas

Slide 37

Slide 37 text

HOW TO PREVENT THIS 37 — @basthomas

Slide 38

Slide 38 text

DOCUMENT 38 — @basthomas

Slide 39

Slide 39 text

DOCUMENT COMMUNICATE 39 — @basthomas

Slide 40

Slide 40 text

DOCUMENT COMMUNICATE QUESTION THINGS 40 — @basthomas

Slide 41

Slide 41 text

DOCUMENT COMMUNICATE QUESTION THINGS ITERATE 41 — @basthomas

Slide 42

Slide 42 text

THANKS! 42 — @basthomas