Please download and unzip HelloWorld_Frank.zip, and select “HelloWorld copy“ to run FrankTests.
Frank (Frankenstein!?) is ‘Selenium for native iOS apps’.
- Frank use KIF and UISpec as base structure, and use UIQuery to locate elements.
- Frank used to based on other framework, but recently it’s changed to KIF, so some documents may out of date. Try to use the latest documents and samples.
- You can use Ruby in Frank rather than Objective-C in KIF.
Environment preparation:
- Install rvm, ruby (1.9.2 is preferred to avoid issue when installing ruby-debug later), frank-cucumber and follow the installation script provided by Frank.
- For debug use, I have added ruby-debug, please gem install it when you see message of that gem is required.
Note:
- Screenshots will be generated under HelloWorld/Frank/screenshots, if the 1st step in
Then /^I can see "([^"]*)"$/ do |welcomeMessage|
is enabled; - DOM can be exported if the 2nd step in
Then /^I can see "([^"]*)"$/ do |welcomeMessage|
is enabled; - Add @record before scenario can start recording, but you should use it only once.
Highly recommend before you start using Frank:
Tips/Limitations:
- Build the app first, then run cucumber; otherwise sometimes, Frank can’t attach to the simulator.
- Encounter one issue which is not fixed, post in the gmail group: Google Groups. It’s about how to check a text filed with space in its value.
- For label, we can’t access their value and check on them, Apple should be blamed, so we can only write code by ourselves to implement it from ground: set accessibilityValue -> write down the method to locate and compare the value -> write the step definition to recall the method -> use the step definition in Frank.
- Few documents/samples for Frank, even how to use selector; and some step definitions are not suitable for use, need to google or write down basic steps for action and validation.
How to use Symbiote (the elements’ tree viewer):
Few material for it, only found http://vimeo.com/22644221 and http://blog.thepete.net/2011/05/inspect-state-of-our-running-ios-apps.html
Debug:
- Using Frank is not easy to debug, using ruby, so can use ruby-debug to debug, but you need to install gem of ruby-debug first, then follow steps in https://gist.github.com/1333785.
- A better way is just installing ruby1.9.2 rather than 1.9.3
- But for the step in Frank itself, you can only use “Console.app” on Mac to see log. Only few useful info can be found.
How to select elements for Frank using UIQuery/UISpec?
Recording of script running:
- Will recording everything from the scenario marked as @record.
- With multiple @record tags, it will open recording app multiple times, which is unusable when recording. So only use @record tag once.
- The recording is a feature of QuickTime player.
Reference