Automation Testing

The Top 7 iOS Automation Tools for Mobile Testing

By Test Guild
  • Share:
Join the Guild for FREE
iOs Mobile Apps

I'm pulling together some of the notes around iOS mobile testing that I've gleaned from research and interviews with TestTalks guests around mobile testing. Also, picking an iOS testing framework is just the beginning, so make sure to check out my post on how you can take the guessing out of your mobile testing coverage efforts. 

Read on to discover the following:

  • The 7 automated testing tools for iOS
  • How to use each iOS Automation tool 
  • Which iOS automation testing tool should you use

For the video version, check [click here]

INDEX

  1. XCTest
  2. UI Automation
  3. OCmock
  4. KIF (Keep It Functional)
  5. FBSnapshotTestCase
  6. FRANK – BDD for iOS
  7. APPIUM

Test Automation Tips and Tricks

1. XCTest

For unit testing, you can use the framework called XCTest. XCTest is provided by Apple and has pretty good integration with the IDE for writing your tests, running your tests, and even doing TDD workflow.

If you performed unit testing before iOS 6, you might have heard of a tool called OCUnit. OCUnit has depreciated, and since Xcode 5, the recommended testing framework has been XCTest.

2. UI Automation

For your more typical functional tests (or black-box tests), in which you're going to write code that simulates an end user navigating your app, there is UI Automation. UI Automation is provided by Apple and is the Apple-sanctioned way of performing iOS functional testing.

To use UI Automation, you need to use Instruments, one of the tools that come with Xcode.

The only problem with UI Automation is that tests are written in JavaScript, whereas iOS code itself is written in Objective-C or Swift, which differs significantly from JavaScript.

UI Automation itself is pretty lightly documented. If you have problems using it, you're left up to trial and error. What's even worse is that there is not much of a community around it that you can consult for support.

Also — when newer versions of XCODE are released, Apple rarely, if ever, issues any new updates to UI testing.

That's kind of the state of testing in terms of what Apple provides.

If the Apple tools don't meet your needs, there are also a couple of pretty popular thirdparty ways to test your iOS code that might actually work better for you.

3. OCmock

I'm aware that many teams love and heavily use OCmock. It's like your typical mock object framework, and it's really good for stubbing out and making mock objects of stuff, like code that leverages in a remote API, like a web service.

You can also use it for code that relies on an available UI, like UI objects that you can't easily instantiate yourself through unit tests.

Free TestGuild Courses

4. KIF (Keep It Functional)

A good alternative to UI Automation is a tool called KIF.

KIF stands for “Keep it Functional.” I like to refer to it as UI Automation ++.

It's a third party, and it's open source.

You write tests much like UI Automation, where you're simulating a user, tapping through the app.

Like UI Automation, it relies on accessibility labels; you define your application, which has the benefit of making your app accessible to people who may be visually impaired who are being prompted through audio queues and how to use your app.

Basically, UI Automation and KIF both rely on you defining accessibility labels on your UI elements in terms of how they navigate the app.

KIF Advantages

A couple of specific benefits KIF has over UI Automation is that you actually are writing the test in Objective-C, which is now supporting Swift. There's no learning curve of swapping languages between Objective-C and JavaScript like you had to do with UI Automation.

Additionally, the way KIF tests are executed in the same type of target that your unit tests are executed in, which is not the case for UI Automation.

In order to execute UI Automation tests, you have to use the other tool by Apple called Instruments (it's also their profiler tool). It's actually a great tool, but kind of like UI Automation that is tacked onto it.

As always, your goal should always be to make your tests repeatable and quickly executable. By integrating with the same way that XCTest runs unit tests, KIF makes those kinds of GUI- based tests much faster to execute.

5. FBSnapshotTestCase

FBSnapshotTestCase was created and is maintained by Facebook. Its basic function allows you to verify your UI code via visual diffs between saved screenshots.

You can do it at a more granular level than the full screenshot of the device. You can pick a little UI view in what you subclass when you see a little widget on the screen; anything from a piece of text to something more complicated. You can also isolate that snapshot test case to that UI view subclass.

I definitely see some usefulness in that beyond the normal kind of simulated click-and-play you might get with UI Automation.

TestGuild Training Sessions – Register Now!

6. FRANK – BDD for iOS

If you want to do end-to-end testing in iOS and wish you could use behavior-driven development (BDD) and Cucumber, no worries –there's a tool called Frank that will allow you to create acceptance tests and requirements using Cucumber.

Frank allows you to run your BDD tests against your iOS application since it acts like an adaptor that connects your app to Cucumber.

The Cucumber recipes book has a nice step-by-step recipe(28) called Test iOS Using Frank that is helpful.

7. APPIUM

Appium is a free, open-source, cross-platform mobile UI automation framework. It allows you to write UI tests for Android and iOS apps and other OSs. It also lets you write it using the Selenium JSON writer you know and love from web automation. 

Appium is becoming an industry standard for mobile testing, much as Selenium WebDriver became the industry standard for browser-based automation a few years ago. Check out my Appium Tutorial for Beginners for more info on Appium.

Mobile Automation Awesomeness for Your Earbuds

I highly recommend that you not only learn more about these tools but heed the advice of engineers who have successfully used these tools to automate their projects in the real world. Check out:

  • Daniel Knott: Hands-On Mobile App Testing
  • Andy Obusek: iOS Testing: The Apple Watch is Coming – Are You Ready?
  • Steve Hazel: How to Make Your Automation Better & New Sauce UI

Register for Automation Guild 2023 Now!

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

SafeTest: Next Generation Testing Framework from Netflix

Posted on 03/26/2024

When you think of Netflix the last thing you probably think about is ...

Top Free Automation Tools for Testing Desktop Applications (2024)

Posted on 03/24/2024

While many testers only focus on browser automation there is still a need ...

Bridging the Gap Between Manual and Automated Testing

Posted on 03/13/2024

There are some testers who say there’s no such thing as manual and ...