Question

I'd like to be able to play back a series of taps on the iOS simulator, ideally produced by recording these taps. If recording is not possible, then maybe I can do it in code, either within the program, or with an external program like AppleScript. Or perhaps with Instruments?

Is any of this possible? I would need to be able to start playing user actions after starting an app.

Was it helpful?

Solution

There are multiple native and hybrid iOS testing frameworks that will allow you to create test scenarios (such as simulating user taps), record those events and use them for playback later, possibly in a CI environment. The following lists some of those frameworks which we have looked at and some which we have used in our mobile environment.

KIF

Overview:

KIF stand for “Keep It Functional”. It allows for easy automation of iOS apps by leveraging the accessibility attributes that the OS makes available for those with visual disabilities.

KIF relies on the built-in accessibility of iOS to perform its test steps. As such, it's important that your app is fully accessible. This is also a great way to ensure that your app is usable by the sight impaired. Making your application accessible is usually as easy as giving your views reasonable labels. More details are available in Apple's Documentation.

Website with source code and instructions can be found on Github

Test cases are created in Objective-C via Xcode/AppCode.

Frank

Overview:

Frank is 'Selenium for native iOS apps'. Frank allows you to write structured text test/acceptance tests/requirements (using Cucumber) and have them execute against your iOS application.

The main premise is the framework embeds an HTTP server into a test version of the app and then allows the client to send HTTP requests to the app to run test scenarios.

“Frank also includes a powerful “app inspector” (called Symbiote) that you can use to get detailed information on your running app. This allows you to inspect the app for objects on the screen.”

Test Cases: Test cases are written in natural language using Cucumber.

(site already mentioned above)

Calabash

Overview:

Calabash is built upon the same architecture as Frank. It embeds an HTTP server into a test version of the app and then allows the client to send HTTP requests to the app to run test scenarios.

“Calabash is cross-platform, supporting Android and iOS native apps. It is open source and free, and has a company, LessPainful, backing and developing it.”

“Calabash consists of libraries that enable test-code to programmatically interact with native and hybrid apps. The interaction consists of a number of end-user actions.

Test cases are written in the natural language via Cucumber. Here is an example:

Main website: http://calaba.sh

MonkeyTalk

(previously known as “FoneMonkey”)

Overview: Monkeytalk is an automated testing framework that provides the user the ability to record a set of instructions and then playback those scripts in the simulator or device.

MonkeyTalk is free and open-source. It can be run from the command line so it would appear to be a good candidate for use in the CI build environment. It also generates JUnit XML files which are used to report test results in Jenkins.

MonkeyTalk provides libraries which are compiled into a test version of the app.

Test Cases: MonkeyTalk comes with its own IDE for test case creation. It records the actions done on the simulator or the device and can play them back in script form. It allows the ability to provide data files for input data such as names and passwords. The IDE runs on Windows, OSX or Linux however, the iOS devices and simulators will only run in OSX.

Main: http://www.gorillalogic.com/testing-tools/monkeytalk

OTHER TIPS

I think the open source state-of-the-art for this is Frank. Can't record actions, but you can specify a set of taps, gestures, etc in code. As a bonus, it forces you to have the accessibility things set up properly, since that's what it uses to drive the tests.

test-studio can record user actions and it is free!

Sikuli Script is newer and works with iOS and within the simulator - http://www.sikuli.org

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top