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

WWDC 2021: What's New in Testing

WWDC 2021: What's New in Testing

A roundup of testing related new features from WWDC 2021. Slides from the 2021/06/10 Melbourne CocoaHeads Meetup.

Including: Xcode Cloud, XCTExpectFailure, addTearDownBlock, and Test Plans.

To learn more about testing in Swift, checkout my book Test-Driven Development in Swift.

Gio Lodi

June 10, 2021
Tweet

More Decks by Gio Lodi

Other Decks in Programming

Transcript

  1. What’s new in Testing
    Gio Lodi, Mobile Infrastructure @ Automattic
    Melbourne CocoaHeads 2021/06/10
     WWDC21

    View Slide

  2. • Xcode Cloud

    • async/await & test

    • XCTExpectFailure
    • Test Repetition
    • addTearDownBlock { }

    View Slide

  3. Xcode Cloud
    So that’s what they bough BuddyBuild for…

    View Slide

  4. View Slide

  5. • Xcode Cloud docs homepage

    • Supports GitHub, GitHub Enterprise, Bitbucket Cloud, Bitbucket Server,
    GitLab, and GitLab self-managed instances
    • Environment Variables CI, CI_BUILD_ID, CI_XCODE_SCHEME,
    CI_TEST_PLAN, CI_PULL_REQUEST_NUMBER, …

    • Web Hooks – Note: You can configure up to five web hooks per Xcode Cloud
    product.

    View Slide

  6. Requirements for Using Xcode Cloud

    View Slide

  7. About Continuous Integration and Delivery with Xcode Cloud

    View Slide

  8. Review code and collaborate in Xcode

    View Slide

  9. Review code and collaborate in Xcode

    View Slide


  10. Would you trust
    to do all that for you
    in the ?!

    View Slide

  11. async/await ❤ unit tests
    Testing async code just go easier

    View Slide

  12. https://mokacoding.com/blog/how-to-test-async-await-code-in-swift/

    View Slide

  13. https://mokacoding.com/blog/how-to-test-async-await-code-in-swift/

    View Slide

  14. XCTExpectFailure
    The best API you should never use

    View Slide

  15. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  16. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  17. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  18. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  19. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  20. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  21. https://mokacoding.com/blog/xctexpectfailure

    View Slide

  22. Test Repetition
    More tools to avoid dealing with address flaky tests

    View Slide

  23. Diagnose unreliable code with test repetitions

    View Slide

  24. Diagnose unreliable code with test repetitions

    View Slide

  25. Diagnose unreliable code with test repetitions
    Until Failure

    View Slide

  26. Diagnose unreliable code with test repetitions
    Retry on Failure

    View Slide

  27. Diagnose unreliable code with test repetitions
    Up Until Maximum Repetition

    View Slide

  28. addTearDownBlock
    I couldn’t find a snarky remark for this one…

    View Slide

  29. View Slide

  30. Test-Driven Development
    in Swift
    tddinswift.com

    View Slide

  31. One more thing…

    View Slide

  32. Vim key bindings
    So you’ll never be able to quite Xcode again

    View Slide

  33. • Vim key bindings introduce “Modal Editing”

    • Normal mode – Verb + Movement + Subject

    • Insert mode

    • Visual mode

    • Limited support (for now? $%)

    View Slide

  34. Demo Time

    View Slide

  35. mokacoding.com/xcode-heart-vim

    View Slide

  36. & Gio Lodi
    Mobile Infrastructure Engineer @ Automattic
    @mokagio
    mokacoding.com
    gio.codes

    View Slide