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
Tweet

More Decks by Tamar Nachmany

Other Decks in Technology

Transcript

  1. 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
  2. definition: Unit tests validate individual units of code by executing

    logic and asserting expected results @tamarshmallows
  3. Presentation logic func present(photoLibrary: PhotoLibraryViewController) { switch photoLibrary.configuration { case

    .iMessage: // Add photo library as child case .Compose: // Present photo library modally } } @tamarshmallows
  4. 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
  5. Definition: The principle that a type should serve a specific

    defined purpose and have minimal dependencies @tamarshmallows
  6. Modular code is: 1. Easier to understand 2. Easier to

    unit test 3. Easier to change? @tamarshmallows
  7. You needs state to validate Where does that 'exposure' come

    from? A parameter? A property? @tamarshmallows
  8. Featured artists Rodrigo Tello Ola Szmida Patrick Sluiter Hannah Langford

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