[Mobile] Create and Run iOS Test Case

This tutorial demonstrates how to create test cases for iOS with Katalon Studio using the Mobile Record Utility, then run the recorded test cases.


  • iOS setup. To set up Xcode simulators/ real iOS devices, you can refer to this document: [Mobile] iOS Setup.

In this example, we record the following actions to test the Coffee Timer application:

  1. Launch the Coffee Timer application on the device.
  2. Tap on Green Tea.
  3. Tap on Start.
  4. Tap on Stop.

You can download the sample project as a .zip file here: iOS Mobile Tests.

Create a new project

  1. To create a new project, go to File > New > New Project.

  2. Fill in the displayed New Project dialog as shown below:

    Name The project name
    Type The project type. In this example, we choose the Mobile project type.
    This section allows you to choose a sample project. If you don't want to open a sample project, select the Blank option. In this example, we choose the Sample iOS Mobile Tests Project project.
    Repository URL
    The Github repository URL. After choosing the sample project, Katalon automatically fills in the URL.
     The save location of your project. 
  3. After filling in the project details, click OK. A new mobile project opens.

Record a new Test Case

  1. On the main toolbar, click Record Mobile and select your device type. For our example, we choose the iOS Devices option.

  2. In the displayed Mobile Recorder dialog, specify the information in the Configurations section:

    Device Name
    To select one of your connected iOS devices or Xcode simulators
    Start with
    To select Application File in the dropdown list.
    Application File

    For Xcode simulators: browse Coffee Timer.app

    For real iOS devices: browse Coffee Timer.ipa

  3. Click Start to begin recording your test case. After the application under test (AUT) is launched, you can now see:

    • Device View: this section displays the start page of your AUT. You can interact with the Device View section the same way as in a real iOS device.
    • All Objects: this section displays all objects of the current view in the Device View section.

    For our example, we can see the start page of the Coffee Timer application in the Device View section and its object properties in the All Objects section.

  4. In the Device View section, we click Green Tea. Katalon Studio correspondingly selects the Green Tea object in the All Objects section.

    green tea
  5. Once Green Tea is selected, we click the Tab action in the Available Action section, we now see:

    • The Device View section displays the countdown for Green Tea.

    • Katalon automatically adds the Tap action to the list of recorded steps in the Recorded Actions tab.

    • Katalon also captures the Green Tea object properties and includes it in the Captured Objects tab. To learn more about mobile object properties, you can refer to this document: Manage Mobile Test Objects.


    • If you prefer another locator strategy, you can select your preferred one, then click Generate to generate a new locator. You can also check if your newly updated locator can detect the target object correctly by clicking Highlight.
  6. Similarly, click Start in the Device View section, then click Tap in the Available Actions section.

    Katalon automatically adds another Tap action to the list of Recorded Actions and the Start object properties in the Captured Objects tab.

  7. Next, click Stop in the Device View section, then click Tap in the Available Actions section.

    Katalon automatically adds another Tap action to the list of Recorded Actions and the Stop object properties in the Captured Objects tab.

  8. Click Save script. An open dialog asks you to save captured objects into the Object Repository of Katalon Studio. You can create a new folder or select an existing folder in Object Repository, then click OK.

  9. A dialog opens, providing you three options to save your recorded test:

    Export to new test case To export the recorded test steps to a new test case.
    Append to test case To add the recorded test steps to an existing test case.
    Overwrite test case
    To replace an existing test case with the recorded test case

Run the recorded test case

To run the recorded steps, follow these steps:

  1. Select the test case where you saved the recorded actions.

  2. On the main toolbar, select iOS device in the dropdown list next to Run.

    Execute iOS
  3. In the displayed iOS Devices dialog, select an iOS device or Xcode simulator, then click OK.

    Choose iOS device

    Katalon Studio executes the iOS test with the recorded steps accordingly.

    View the test case in Script mode.

    import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
    import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
    import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
    import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
    import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
    import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
    import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
    import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
    import com.kms.katalon.core.model.FailureHandling as FailureHandling
    import com.kms.katalon.core.testcase.TestCase as TestCase
    import com.kms.katalon.core.testdata.TestData as TestData
    import com.kms.katalon.core.testobject.TestObject as TestObject
    import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
    import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
    import internal.GlobalVariable as GlobalVariable
    import org.openqa.selenium.Keys as Keys
    Mobile.startApplication('/Users/thuyngo/Desktop/Project/iOS/App/Coffee Timer 2021-01-27 16-49-52/Apps/Coffee Timer.ipa', true)
    Mobile.tap(findTestObject('Object Repository/XCUIElementTypeStaticText - Green Tea (1)'), 0)
    Mobile.tap(findTestObject('Object Repository/XCUIElementTypeButton - Start (2)'), 0)
    Mobile.tap(findTestObject('Object Repository/XCUIElementTypeButton - Stop (1)'), 0)

See also: