Getting Started with XCUITest

 

Built on top of Apple's XC testing framework and built into Xcode, XCUITest allows users to create and execute UI, performance, and unit tests on iOS applications.

On the Kobiton UI, automation setting will return the capabilities needed to connect to iOS devices and run an XCUITest from your testing environment. 

XCUITest Automation Settings

To run an XCUITest on Kobiton:

  1. On the Kobiton portal, navigate to the desired iOS device and click the ellipsis icon  vertical-ellipses-icon.png.
  2. Click on Automation Settings.
  3. Fill in the following testing capabilities:
    • Framework: select XCUITest
    • Language: (Java, .Net C#, NodeJS, Ruby, Python, PHP)
    • Session Name:by default, "Automation test session" is set, but the name can be customized
    • Description: Optional session description
    • Session Timeout: Set to 60 minutes by default, but can be changed to designated time
    • User Group:Set by default, but can be changed if part of multiple groups
    • Device Group: Set by default, but click to open the dropdown for other available groups
    • Use specific device: enable to use the specified iOS device only
    • App type: Either upload an application with a URL or an application on the Kobiton App Repository
      • Hybrid/Native from URL
        • Application URL
      • Hybrid/Native from apps
        • Select App from Apps Repo
    • Test Runner: Enter the URL for the test.apk or use click Upload Test Runner to upload a test.apk file 
    • API Key: Populates with the default API key
  4. Use the copy to clipboard icon to copy the generated desired capabilities.
  5. Paste the capabilities to your scripted test. 

Example:

The JavaScript example below will use XCUITest to make a connection to the device through the Kobiton portal. To view this project in Github, click here

const request = require('request')

const username = 'Kobiton.Username';
const apiKey = 'de3135e2-754d-4245-9d5b-51c00b60162e';
const configuration = {
sessionName: 'Automation test session',
sessionDescription: 'Running a basic XCUITest script',
udid: '4321f3564db153a4a274d3a918963a2c4393618b',

groupId: 905, // Group: Kobiton Inc.
deviceGroup: 'KOBITON',
app: 'https://kobiton-devvn.s3-ap-southeast-1.amazonaws.com/apps-test/XCUITestSample.ipa',
testRunner: 'https://kobiton-devvn.s3-ap-southeast-1.amazonaws.com/apps-test/XCUITestSampleUITestRunner.ipa',
testFramework: 'XCUITEST',
sessionTimeout: 30,

tests: []
}

const headers {
'Content-Type': 'application/json',
'Authorization': 'encodeAuth',
'Accept': 'application/json'
}

const body {
configuration
}

request ({
url: 'https://api.kobiton.com/hub/session'
json: true,
method: 'Post',
body,
headers,
}, function (err, response, body) {
if (err) return console.error ('Error:', err)
console.log ('Response body:', body)
})
Was this article helpful?
0 out of 0 found this helpful