Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Visual Testing: A Communication Problem

Visual Testing: A Communication Problem

79fe3c13c618a61329298bdd6a86ec42?s=128

Bas Broek

June 15, 2018
Tweet

Transcript

  1. VISUAL TESTING A COMMUNICATION PROBLEM 1 — @basthomas

  2. COMMUNICATION IS HARD 2 — @basthomas

  3. SNAPSHOT TESTING 3 — @basthomas

  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 10 — @basthomas

  11. WHAT IF THE DESIGN CHANGES? 11 — @basthomas

  12. WHAT IF ONE OF THE PRIMARY INTERACTIONS CHANGES? 12 —

    @basthomas
  13. ! 13 — @basthomas

  14. IT IS EASY TO MAKE A MISTAKE 14 — @basthomas

  15. NAMING IS HARD 15 — @basthomas

  16. NAMING IS HARD > testCellWithPageControlOnPage2of3 > testCellWithLongNameAndJob > testWithShortContent >

    testTwoBirthdaysUnseenElement > testStateLoadMoreFailedInsertedOnTop > testSlideupViewWithNoIconNoButton 16 — @basthomas
  17. DO YOU HAVE ANY IDEA WHAT IT IS WE'RE TESTING

    HERE? 17 — @basthomas
  18. ... MAYBE? 18 — @basthomas

  19. DO YOU HAVE ANY IDEA WHEN THESE TESTS ARE EXPECTEDLY

    FAILING? 19 — @basthomas
  20. ME NEITHER 20 — @basthomas

  21. A FAILING SNAPSHOT TEST 21 — @basthomas

  22. 22 — @basthomas

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

  24. ! 24 — @basthomas

  25. REPLACEABLE BY UNIT TESTS 25 — @basthomas

  26. SNAPSHOTS AT SCALE 26 — @basthomas

  27. WE MADE IT HARDER ON OURSELVES FORK, WRAPPER, WRAPPER, WRAPPER

    27 — @basthomas
  28. DOCUMENT DECISIONS 28 — @basthomas

  29. MULTIPLE SIMULATORS 29 — @basthomas

  30. SPACE 30 — @basthomas

  31. IDE UPDATES 31 — @basthomas

  32. ! 32 — @basthomas

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

  34. SNAPSHOTS ARE SUBJECTIVE 34 — @basthomas

  35. IT IS NOT ALL BAD 35 — @basthomas

  36. QUESTION THINGS > "but I just copied it" > "but

    others are doing it" > "but I can't write a unit test here" > "but ..." 36 — @basthomas
  37. HOW TO PREVENT THIS 37 — @basthomas

  38. DOCUMENT 38 — @basthomas

  39. DOCUMENT COMMUNICATE 39 — @basthomas

  40. DOCUMENT COMMUNICATE QUESTION THINGS 40 — @basthomas

  41. DOCUMENT COMMUNICATE QUESTION THINGS ITERATE 41 — @basthomas

  42. THANKS! 42 — @basthomas