Sikuli iOS Automation

In this short article, I will explain how to create a test automation framework for iOS using Sikuli, iOS simulator and Python unit test. I assume prior knowledge about these technologies and only focus on the actual technical details so that you hit the ground running.

    • Sikuli API is distributed as a Java JAR file. In order to consume Java from Python you need to install Jython, the Java based Python interpreter. You can get it from here
    • In order for Jython scripts to import Sikuli API you need to point to the Sikuli Jar file. Here is an example:

    • Create a shell script to fetch the latest code of your iOS app from your preferred source control system, build it locally, deploy it to the iOS simulator then launch the app. I will include some of the commands that you may need.
    • To make sure that you are using the right Xcode version apply the following command:

    • To build your app from the command line you may use something like:

    • To launch the simulator from the command line do:

where $SIMULATOR can be retrieved by the following command:

    • To install the app that you just built use:

    • To uninstall use:

or whatever ID the app may have.

  • Here is a sample Jython script that uses Python unittest which invokes Sikuli for image based testing:

Please use the comments section below for questions, corrections or feedback. Thanks for reading.

Add a Comment

Your email address will not be published. Required fields are marked *