I designed my presentation around 3 main question that needed an answer: What, Why, How.
Frank is a tool for UI automation testing of iOS and Mac apps. it also includes a neat app inspector, called Symbiote.
He is quite old in the market, has been around for 2 years or so. When it was launched Frank extended KIF, another framework with the same purpose. Meanwhile Apple made their framework, PublicAutomation, available for free, so Pete Hodgson (the creator of Frank) switched to it. Basically with Frank, you get the power of Apple and the possibility to adapt it to your needs.
Alternatives to Frank:
UIAutomation – restrictive (included in Instruments from Xcode)
KIF – was extended by Frank
Calabash - for full power you must use Xamarin, which is not free
EggPlant – accesses your application over remote control, which is pretty neat, but unfortunately is not free.
Appium – a good option too, especially if you have a cross platform application
3. What is Frank?
● Basic 'Selenium for native iOS apps'.
● Write automated acceptance tests
● Verify the functionality of native iOS apps.
● Symbiote - a powerful “app inspector”
4. Why: Advantages
• Easy Setup - less than 10 minutes.
• Record Video - of the test runs to show the app in action
• Run everywhere - has support for Simulator and Device
• Integrates with CI - run on every check in
• Great Community - strong, helpful community Google Group
5. Disadvantages
• Doesn’t support Record and Play
• Improvements based usually only on community requests
• Lack of documentation
7. Communication
• Frankly - simple HTTP-based wire protocol.
• GET and POST requests
• Request and response bodies contain JSON
8. Response Format
• Responses may either be standard or non-standard.
• A standard response always conforms to a format similar to:
{
'outcome': 'SUCCESS',
'results': ['foo','bar']
}
indicating a failure format:
{
'outcome': 'ERROR',
'reason': 'Failed to frob the flib',
'detail': 'Flange capacitator decoupled'
}
• Non-standard responses will be valid JSON documents
9. Frank Server
• Written in objective-C
• Compiled into the automated iOS application
• Provides responses to the Driver
10. Frank Driver
• Cucumber Driver - implemented in ruby
• Shelley - a selector engine to access a subset of UI elements.
• Create additional drivers rewriting frank_helpers.rb
• Frank helpers - a core set of helper functions
11. How to use Frank
• Designed to work with Cucumber.
• Can be adapted to other languages too.
• Examples: Cucumber and Java.
turn on the accessibility features on the machine hosting your iOS simulator.
Go to System Preferences -> Universal Access and Check “Enable access for assistive
devices”.
12. Frankify the app
• the process of adding a separate Frank target to your app
• has the Frank server embedded into it
• allowing it to respond to automation commands.
Frankified application
Application Frank Server
13. Frankify the app
• install the frank-cucumber gem by running:
sudo gem install frank-cucumber
(run this into the project's root directory – the one with the
.xcodeproj file)
• create the Frank subdirectory which contains everything necessary
to Frankify you app by running
frank setup
14. Frankify the app
• create a Frankified version of you app by running:
frank build
• launch the Frankified app in the simulator by running:
frank launch
• check that you are indeed running a Frankified version by
running:
frank inspect
15. Symbiote
● creates a tree structure with the UI Elements from you app.
● must have the app running in the simulator.
● the application should be exactly on the same screen as
Symbiote, for it to work.
● when investigating a different screen, the browser must be
refreshed.
● access it from browser at http://localhost:37265/
16. Shelley
● Symbiote uses Shelley to access the UI Elements via queries.
● Verify if an element is accessible from browser using a query that
should have the final result highlighting the desired element.
● Examples of queries:
○ view:'UILabel' marked:'Saved Tabs'
parent view:'TableViewCell'
○ button:"UIButton" marked:'btn plus' index:0
17. Frank using Cucumber
• Cucumber - a tool that executes plain-text functional descriptions
as automated tests.
• Gherkin
– the language that Cucumber understands.
– Business Readable, Domain Specific Language
– serves two purposes — documentation and automated tests.
18. Speaking the same language
• Cucumber supports over 40 spoken languages
• Listing the available languages: cucumber --i18n help
Ahoy! me
buckos
19. Example
Feature: Navigating between screens
Scenario: Moving from the 'Home' screen to the 'Events' screen and
navigate through it
Given I launch the app
When I navigate to "Events"
Then I should be on the Events screen
When I navigate Events to "Count Down"
Then I should be on the Count Down screen
20. Conclusions
• Open source tool for automation testing against iOS apps
• Adaptable to one’s needs
• Uses the power provided by Apple’s framework
• Great community that provides support
21. Bibliography
• The Official Website: testingwithfrank.com
• The GitHub Repository: moredip/Frank
• Pete Hodgson’s Blog: Being Agile
• Google Group: Frank
• Frank Helpers: rdoc.info/gems/frank-cucumber