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

Unit Testing for Designers

Unit Testing for Designers

I gave this talk at the Playgrounds Conference in Melbourne, Australia, February 2017. Video should be up in a month or two!


Tamar Nachmany

February 24, 2017


  1. @tamarshmallows

  2. Unit testing for designers Tamar "Tim Tam" Nachmany @tamarshmallows

  3. @tamarshmallows

  4. Design is incredibly important at Tumblr. @tamarshmallows

  5. @tamarshmallows

  6. @tamarshmallows

  7. You're at teacher training @tamarshmallows

  8. Using unit testing to teach modularity & architecture Overview -

    What is unit testing? - What is modularity? - How does unit testing impact software architecture? - Modularity and change - Why? @tamarshmallows
  9. What is unit testing? @tamarshmallows

  10. Software development is the expansion and adaptation of a system

  11. Software development is the reuse of logic and types across

    a system @tamarshmallows
  12. definition: Unit tests validate individual units of code by executing

    logic and asserting expected results @tamarshmallows
  13. A unit is An isolated piece of code @tamarshmallows

  14. Unit testing is a vehicle for change @tamarshmallows

  15. Unit testing automates identifying new issues @tamarshmallows

  16. Not all software can be unit tested @tamarshmallows

  17. Presentation logic func present(photoLibrary: PhotoLibraryViewController) { switch photoLibrary.configuration { case

    .iMessage: // Add photo library as child case .Compose: // Present photo library modally } } @tamarshmallows
  18. Presentation logic testing func testPhotoLibraryPresentationForiMessageConfiguration() { // Make a presenting

    view controller let presentingViewController = PresentingViewController() // Make a photo library view controller let photoLibrary = PhotoLibraryViewController(configuration: .iMessage) // 'Present' photo library presentingViewController.present(photoLibrary: photoLibrary) // Assert that photo library was added as a child view controller XCTAssertEqual(photoLibrary.parentViewController, presentingViewController) } @tamarshmallows
  19. Tests reflect the construction of a codebase or type @tamarshmallows

  20. What is modularity? @tamarshmallows

  21. Modularity is how units become units @tamarshmallows

  22. Definition: The principle that a type should serve a specific

    defined purpose and have minimal dependencies @tamarshmallows
  23. View Model Parser Data Source Presenter Determiner Provider @tamarshmallows

  24. Minimal dependencies @tamarshmallows

  25. Modular code is: 1. Easier to understand 2. Easier to

    unit test 3. Easier to change? @tamarshmallows
  26. The purpose of a single-purpose type is easier to understand

  27. Developers communicate through abstractions @tamarshmallows

  28. Like designers, we negotiate innovation & communication @tamarshmallows

  29. How does unit testing impact software architecture? @tamarshmallows

  30. Testing promotes safety @tamarshmallows

  31. What is safety? @tamarshmallows

  32. Safety is the reduction of bugs and crashes @tamarshmallows

  33. Safety is the reduction of chaos @tamarshmallows

  34. Developers are highly focused on how change happens @tamarshmallows

  35. When a change happens, does it reuse code? Is that

    code tested? @tamarshmallows
  36. Designing a test is a type of abstraction @tamarshmallows

  37. You needs state to validate Where does that 'exposure' come

    from? A parameter? A property? @tamarshmallows
  38. Modularity and change @tamarshmallows

  39. Understanding software development means understanding change @tamarshmallows

  40. Does modularity make code easier or harder to change? @tamarshmallows

  41. Modular code is strict by design @tamarshmallows

  42. Modularity makes a type easier to reuse but harder to

    change @tamarshmallows
  43. But testing fundamentally makes change easier @tamarshmallows

  44. Prototyping isn't just about speed @tamarshmallows

  45. It's about an app's foundations @tamarshmallows

  46. Why? @tamarshmallows

  47. Innovation Don't learn by example: be the example @tamarshmallows

  48. Seeing the future is good for software @tamarshmallows

  49. Software architecture is design @tamarshmallows

  50. Collaboration @tamarshmallows

  51. Let's build a beautiful system together @tamarshmallows

  52. Say hello. @tamarshmallows @tamarshmallows

  53. Featured artists Rodrigo Tello Ola Szmida Patrick Sluiter Hannah Langford

    Berman Dai Ruiz Alastair Gray Joel Plosz Mathew Lucas Susanna Bauer Kennedy Dickerson @tamarshmallows