Sample iOS mobile project in Katalon Studio
This sample demonstrates iOS testing fundamentals in Katalon Studio.
The application under test is the Coffee Timer
application, which contains different timers for different coffee types.
Requirements
- iOS setup. To set up Xcode simulators/ real iOS devices, you can refer to this document: [Mobile] iOS Setup.
Open the sample iOS test project
To open the iOS sample project, in Katalon Studio, go to File > New Sample Project > Sample iOS Mobile Tests Project.
Alternatively, you can download the iOS sample project from our GitHub repository: iOS sample.
Prepare the iOS application file
The Coffee Timer
application located in the App
folder of this sample project is pre-built and signed by the Katalon team to only run on Katalon devices.
As part of the iOS development procedure, to execute the sample test cases with your iOS devices, you need to build and sign the Coffee Timer
application for your iOS devices.
For iOS simulators
To execute the sample test cases with Xcode simulators, you need to prepare an .app
file.
For real iOS devices
To execute mobile testing with real iOS devices, you need to prepare an .ipa
file.
iOS sample project components
Test cases
There are two test cases for different purposes:
The Mexican Coffee Timer test case starts and stops the timer for making a Mexican coffee. In this example, we run the test case with a real iOS device.
- Start the
Coffee Timer.ipa
application. Here, we use thesample.Common.startApplication
custom keyword to run the application. - Tap Mexican. We set the timeout for 0 seconds.
- Tap Start. We set the timeout for 0 seconds.
- Tap 3:19. We set the timeout for 0 seconds.
- Tap Stop. We set the timeout for 0 seconds.
- Tap Back. We set the timeout for 0 seconds.
- Close the application.
You can see the test script as follows:
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 com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
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.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
CustomKeywords.'sample.Common.startAppliucation'()
Mobile.verifyElementText(findTestObject('Spy/XCUIElementTypeStaticText - Mexican'), 'Mexican')
Mobile.tap(findTestObject('XCUIElementTypeStaticText - Mexican'), 0)
Mobile.tap(findTestObject('XCUIElementTypeButton - Start'), 0)
Mobile.tap(findTestObject('XCUIElementTypeStaticText - 319'), 0)
Mobile.tap(findTestObject('XCUIElementTypeButton - Stop'), 0)
Mobile.tap(findTestObject('XCUIElementTypeButton - Back'), 0)
Mobile.closeApplication()
The Verify the main list test case verifies the list of the coffee name in the application. In this example, we run the test case with a real iOS device.
- Start the
Coffee Timer.ipa
application. Here, we use thesample.Common.startApplication
custom keyword to run the application. - Verify if the application is showing the Mexican item.
- Verify if the application is showing the Colombian item.
- Verify if the application is showing the Coffees item.
- Close the application.
You can see the test script as follows:
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 com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
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.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
CustomKeywords.'sample.Common.startAppliucation'()
Mobile.verifyElementText(findTestObject('Spy/XCUIElementTypeStaticText - Mexican'), 'Mexican')
MobileBuiltInKeywords.verifyElementText(findTestObject('Spy/XCUIElementTypeStaticText - Colombian'), 'Colombian')
MobileBuiltInKeywords.verifyElementText(findTestObject('Spy/XCUIElementTypeStaticText - Coffees'), 'Coffees')
Mobile.closeApplication()
Test suites
To access the test suite in this project, in the Test Explorer panel, go to the Test Suites > Smoke Tests folder. This test suite combines the two test cases shown above.