Top 5 iOS Test Automation Frameworks with Examples

Top 5 iOS Test Automation Frameworks
(Last Updated On: 16 Oct 2017)

With the proliferation of iOS devices year over year, the threshold of iOS success is higher than ever before. More companies like startups and SMEs find it not financially sustainable to acquire every piece of iOS devices with different OS versions and HW specs. On the other way, testing apps or games manually is not anymore an ideal option for QA process due to low efficiency and scalability issue.

Though iOS is still a more closed operating system compared to Android, many open source test automation frameworks and tools can be utilized to create robust automated tests. Along with the help of a cloud-based testing solution, it enables developers/testers to verify app quality more efficient in a scalable way and makes iOS testing tasks easier.

Today we’d like to go through 5 widely used iOS testing frameworks nowadays with simple code samples to give you a basic understanding of getting started with your iOS testing. If you are also interested in Android test automation frameworks, do not forget to check out Top 5 Android Testing Frameworks, where code samples are provided as well.

1. Appium

Appium is popular due to its flexibility and usability on both Android and iOS, and it works on native, hybrid and web applications. For iOS testing, it uses JSONWireProtocol to engage with iOS applications using Selenium WebDriver. Thanks for that, Appium does support mobile web testing very well and its use cases are very similar as if Selenium would be used for web testing. Download our Appium beginner’s guide to learn how to set up Appium for mobile app testing.

Appium code sample:

driver.findElement("")).sendKeys("Simple Test");
// or alternatively with

2. XCTest / XCUITest

XCTest and XCUITest are two integral test automation frameworks for iOS app testing. XCTest allows developers to write tests for components at any level and also provides the framework for UI testing capabilities. XCTest tests are grouped into subclasses of XCTestCase. Typically XCUITest is used for functional testing, automating tests of common workflows, demo sequences or behavior of customer views. The framework comes with XCUITest Recorder, a tool for recording the first steps of the automated test. To find elements, their properties and navigating through the element tree of the application, one can also make use of the interface builder. Looking at XCTest/XCUITest for iOS app testing? Download our free guide to leverage the framework in your daily iOS testing job

As for programming langugages, XCTest/XCUITest are fully compatible with both Objective-C and Swift.

Code sample with Objective-C:

- (void)testClicksOnRadioButtons {
[tester tapViewWithAccessibilityLabel:@”Radio1”];
[tester tapViewWithAccessibilityLabel:@”Radio2”];
[tester tapViewWithAccessibilityLabel:@”Radio3”];
[tester enterText:@”Simple Test”
[tester tapViewWithAccessibilityLabel:@”Answer”];

Code sample with Swift

testClicksOnRadioButtons() {
let app = XCUIApplication()

app.staticTexts[“Simple Test”]

Learn and get started with KIF by reading our blog about this: How to get started with KIF?

3. Calabash

Calabash is another great cross-platform framework that works perfectly with Android and iOS apps. One of the major differences to other frameworks is that Calabash tests are written in Cucumber. That means the test is written like a specification and is simple and easy to read even for non-tech people, but still executable by the automation system. Download this Calabash 101 to sharpen your Calabash skills and master this framework

Calabash code sample:

Feature: Answer the Question feature
Scenario: As a valid user I want to answer app question
I wait for text "What is the best way to test application on hundred devices?"
Then I press Radio button 0
Then I press Radio button 1
Then I press Radio button 2
Then I enter text "Simple Test" into field with id "editText1"
Then I press view with id "Button1"

4. EarlGrey

To some degree, EarlGrey is the ‘Espresso for iOS’. It’s also developed and open sourced by Google. Google uses this test framework to test many iOS native apps including Google Calendar, YouTube, etc. As the codename goes, lots of similarities can be found between Espresso and EarlGrey. For example, EarlGrey tests will automatically wait for events (animations, network requests etc.) before trying to interact with the UI.

EarlGrey code sample:

- (void)testBasicSelectionAndAction {
[[EarlGrey selectElementWithMatcher::grey_accessibilityID(@"ClickHere")]

// Example of long press with EarlGrey matchers
- (void)testLongPress {
[[EarlGrey selectElementWithMatcher::grey_accessibilityLabel(@"Box")]
[[EarlGrey selectElementWithMatcher::grey_accessibilityLabel(@"One Long Press")]

// Example of multi-select, visible click on items
- (void)testCollectionMatchers {
id visibleSendButtonMatcher =
grey_allOf(grey_accessibilityID(@"Box"), grey_sufficientlyVisible(), nil);
[[EarlGrey selectElementWithMatcher:visibleSendButtonMatcher]

5. Jest / Jasmine

Jest uses Jasmine behavior-driven framework as the basis for testing JavaScript code. Every test case starts from describe() function call, similar to how JUnit uses TestCase class. The describe() function takes 2 parameters – the description/title of the test case and the function to be executed. The it() function includes all the test steps and provides (similar to JUnit) series of expect() functions.

Jasmine code sample:

describe("Player", function() {
var player;
var song;
beforeEach(function() {
player = new Player();
song = new Song();
it("should be able to play a Song", function() {;
//demonstrates use of custom matcher
describe("when song has been paused", function() {
beforeEach(function() {;

it("should indicate the song is paused", function() {
// demonstrates use of 'not' with a custom matcher
it("should be possible to resume", function() {
// demonstrates use of spies to intercept and test method calls
it("tells the current song if the user has made it a favorite", function() {
spyOn(song, 'persistFavoriteStatus');;
//demonstrates use of expected exceptions
describe("#resume", function() {
it("should throw an exception if song is already playing", function() {;
expect(function() {
}).toThrow("song is already playing");

BONUS: UI Automation

UI Automation is a tool developed by Apple that automates the testing of iOS applications. Put in another way, UI Automation to iOS is similar with UI Automator to Android. UI Automation tests are written in JavaScript, adhering to an API defined by Apple. Below is the code written on Apple’s Developer portal.

NOTE! UI Automation still works fine if you are some using older version of Xcode, but with the latest Xcode the entire UI Automation framework is deprecated by Apple.

UI Automation code sample:

If Edit button is the first button in your code, you can also have the code as below:
Then you can use any of these three ways to call an action to tap that button:
var editButton=UIATarget.localTarget().frontMostApp().mainWindow().buttons()[0];

The Automation instrument has a complete element hierarchy that represents your app’s user interface. To view that hierarchy, use the logElementTree method to write an outline of it to the log:


Though iOS app testing is totally different than Android app testing, you can use either Appium or Calabash to create test scripts that can be used to do cross-platform testing. That being said, every framework has its advantages and everyone of you have different needs for the projects you are working on. It’s recommended to do some further research, learn more about each framework and choose the one you are comfortable with. Happy iOS testing.

Calabash 101: Basics, Getting Started and Advanced Tips

(Last Updated On: 7 Dec 2016)

Go through the basics of Calabash, how to create proper Calabash tests and how to make the most of them.


  • Thank for your wonderful article.
    So, I have question, how about the integration test for APIs,
    For ex, I have 5 APIs, I want to implement integration test for 5 API, what framework can i use in Xcode?

  • govindrajput

    It was very helpful for iOS developers so I really impress in this article and I
    like it some are words Though iOS app testing is totally different than
    Android app testing, you can use either Appium or Calabash to create
    test scripts that can be used to do cross-platform testing. That being
    said, every framework has its advantages and everyone of you have
    different needs for the projects you are working on. It’s recommended to
    do some further research. well.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.