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

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

Ellen Shapiro

October 14, 2015
Tweet

More Decks by Ellen Shapiro

Other Decks in Technology

Transcript

  1. UI TESTING IN XCODE 7 COCOAHEADS CHICAGO | OCTOBER 2015

    BY ELLEN SHAPIRO VOKAL.IO | JUSTHUM.COM | @DESIGNATEDNERD
  2. IF I DIDN'T KNOW THE DEVELOPERS WERE EUROPEAN, I'D SAY

    THIS NEW DECKSET THEME WAS DESIGNED BY A PACKERS FAN
  3. USERS GIVE EXACTLY ZERO FUCKS HOW WELL YOUR APP WORKS

    UNDER THE HOOD IF IT DOESN'T DO WHAT THEY NEED IT TO DO
  4. 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
  5. 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
  6. 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+)
  7. 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
  8. !

  9. 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!
  10. 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/