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

iOS Testing with Frank

oisin
October 09, 2012

iOS Testing with Frank

Tiny introduction to Frank for acceptance testing iOS apps. Was presented at the October 2012 Dublin XCake meetup.

oisin

October 09, 2012
Tweet

More Decks by oisin

Other Decks in Programming

Transcript

  1. Intro • Frank is a set of tools to help

    you achieve automated acceptance testing* for an iOS app • It uses iOS accessibility labels, Cucumber, UISpec and a little embedded web app to get its thing done • Cucumber is a so-called BDD test framework for Ruby • UISpec is a so-called BDD test framework for iOS, writting Objective C - it’s like Rspec http://testingwithfrank.com/getting_started.html * answers the question - “are we done yet?” Wednesday 10 October 12
  2. Architecture • Frank binds cucumber steps on the host to

    UISpec on the sim • The binding happens through a mini web-app that lives in your app • So you compile it in - frankifying your app tests cucumber frank driver frankly protocol frank UIspec app https://github.com/moredip/Frank/wiki/Frankifying-your-app-in-XCode-4 Wednesday 10 October 12
  3. Writing tests: steps • You write your tests using the

    Cucumber DSL style, with a selection of Frank- specific extensions. You get tests that looks a bit like this. • You can write your own steps Wednesday 10 October 12
  4. Writing tests: selectors • These specify the UI elements that

    the test will drive and from where it will read state. • “select an UIImageView with accessibility label small-check in UITableViewCell that is the parent of a UITableViewCell that has a label marked with the accessibility label Milk” srsly, it all makes more sense here: http://testingwithfrank.com/selector_syntax.html Wednesday 10 October 12
  5. • I like this a lot. It’s an introspection tool.

    It’s fantastic for showing the view hierarchy and what is going on where. • It has a live part too, so you can watch interactions as you take them in the sim. • You can drill into the view properties Wednesday 10 October 12
  6. Downsides • Cucumber is rubbish. Really dislike it. • It’s

    fine on the simulator, apparently its terrifically messy to run on the device - I didn’t go that far. • Gestures not supported. • It’s compiled in. Your Frankified app is a new target in Xcode. You could probably make sure that it doesn’t get compiled into you production code. Wednesday 10 October 12
  7. Test Quandaries • I ran some tests and played with

    Symbiote a bit - thought it was great, but obviously the Cucumber stuff had to die. • Luckily the Frankly protocol is a simple HTTP/JSON thing, so it should be simple to write a new driver... BUT • I started thinking about why one tests. Mostly, it’s 1: To prove you are done. 2: To allow you to change stuff with confidence. • With apps, sometimes all you want is 1 - and then, is it worth going through the setup here? Maybe if you re-use enough UI artifacts, it is. Discuss. Wednesday 10 October 12