UI Testing in Xcode 7 - CocoaHeads Chicago, October 2015

UI Testing in Xcode 7 - CocoaHeads Chicago, October 2015

Initial look at UI testing in Xcode 7, both in general and specifically with XCUI tests and KIF tests.

NOTE: If you attended this talk, you'll see I updated the slide where I talked about trying to launch tests from the static setUp() method. Here's a video of me trying to make that work and the hilarisad result: https://www.youtube.com/watch?v=pR0iRf_2j7k

C4861b1dfdf3bbb21faec4a1acdf183d?s=128

Ellen Shapiro

October 14, 2015
Tweet

Transcript

  1. 1.

    UI TESTING IN XCODE 7 COCOAHEADS CHICAGO | OCTOBER 2015

    BY ELLEN SHAPIRO VOKAL.IO | JUSTHUM.COM | @DESIGNATEDNERD
  2. 2.

    IF I DIDN'T KNOW THE DEVELOPERS WERE EUROPEAN, I'D SAY

    THIS NEW DECKSET THEME WAS DESIGNED BY A PACKERS FAN
  3. 4.
  4. 9.

    USERS GIVE EXACTLY ZERO FUCKS HOW WELL YOUR APP WORKS

    UNDER THE HOOD IF IT DOESN'T DO WHAT THEY NEED IT TO DO
  5. 15.
  6. 16.
  7. 17.
  8. 19.

    XCUI: WHAT IS? > Added by Apple as part of

    Xcode 7 + iOS 9 > Takes Javascript out of UIAutomation > Allows you to record actions > Automatically refactors code as you record* *-SORT OF
  9. 20.

    XCUI: HOW WORK? > Builds queries against views > Finds

    elements using those queries > Element requests are evaluated on-demand > Test runs in separate process than your app
  10. 22.
  11. 24.

    KIF: WHAT IS? > "Keep It Functional" > Built and

    open-sourced by Square > Huge, gnarly codebase, but it's open-source > Runs anywhere XCTest does (iOS 7+)
  12. 25.

    KIF: HOW WORK? > Uses private methods to tap and

    swipe through the app > Runs in the same process as your app > YOU reset your your UI before each test
  13. 26.
  14. 28.
  15. 30.
  16. 33.
  17. 35.
  18. 36.
  19. 37.
  20. 38.
  21. 39.

    !

  22. 41.

    OBLIGATORY SUMMARY SLIDE > UI Testing helps make sure all

    the pieces of your app are working together > Accessibility labels != accessibility identifiers > XCUI testing still has some significant holes > tap things to get a shortcut to what they are in code > Don't repeat yourself applies to tests too!
  23. 42.

    LINKS > Demo app: https://github.com/designatednerd/ GoCubs > Xcode UI Testing

    WWDC Session: https:// developer.apple.com/videos/play/ wwdc2015-406/ > UI Testing Gotchas from Big Nerd Ranch: https:// www.bignerdranch.com/blog/ui-testing-in- xcode-7-part-1-ui-testing-gotchas/