Support Center

Getting Started

Last Updated: Sep 24, 2013 10:44AM CEST


Testdroid Cloud provides a test project skeleton for writing test scripts for iOS platform. Example Test Case for iOS can be found here. Test scripts are written in JavaScript. Knowledge about used frameworks is required, however, those are very simplistic and well described frameworks. The first one is the UI Automation framework provided by Apple.

The second one is the Jasmine framework.

Inside Testdroid Cloud example ios-test-skeleton you can find files/folders as follows:
  • 'ext' directory – Jasmine framework is located here.
  • 'reporters' directory – the reporter(jasmine.uiautomation_junit_reporter.js) is located here and will be used to create jUnit .xml file with test results.
  • 'specs' directory – the test specifications are located here.
  • 'suite.js' file – the main file of test scripts. This is the file which is passed to UI Automation tool to run tests. It generally shouldn't be changed but new test specifications should be added only for instance:
#import "specs/loginTestCase.js"


Every test case starts from describe() function (in Jasmine, it is used similarily as TestCase class in jUnit). This function takes 2 parameters: description/title of the test case and the function to be executed. Inside this function user should place another function(s) - it(). This function in Jasmine is something similar to TestMethod in jUnit. It also takes 2 parameters: the description/title and function to be executed.

Result of every it() function will be presented at Testdroid Cloud separately. To exercise good practice it is recommended to have every test case in separated file instead of one file with several describe() functions.


Inside this method, the test steps are done. User clicks on elements, goes to interesting place in app, check important things and so on. In Jasmine instead of well-known asserts from jUnit a series of expect() functions are provided. For instance:

expect(target.frontMostApp().mainWindow().textFields().length > 0).toBe(true)

This can be used to verify if there is any UITextField object on window. In addition, it is very useful to take screenshots that can be later reviewed at Testdroid Cloud results. Thiscan be done by using the following function:


In order to get those screenshots shown in proper order at Testdroid Cloud, it is recommended to use numeral order in the beginning of screenshot name.


For writing test scripts, Instruments -> Automation tool is very useful and also required to write test scripts. In this tool user can choose the target application and run scripts to see how the execution goes or record his/her actions. In order to make it run fine, it is also recommended that user reviews the generated code and playbacks it as sometimes generated code can be 'messy'. After recording any actions user can copy-paste produced code to one of it() functions.

In addition, it is useful to use the following methods:

var target = UIATarget.localTarget();

These produce in console output the whole tree of current views and in this way user can easily find out indexes, names, etc. of the views for further action.


If user wants to run the whole test project before uploading it to Testdroid Cloud, they can import suite.js in UI Automation tool and simply click on the play button.

Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found