XCTest

Prev Next

XCUITest is a mobile automation framework provided by Apple that helps user write UI tests for your iOS applicationsThis guide will help you run your first XCUI test on pCloudy.

  1. User should be registered on pCloudy platform. Sign up for a free trial or purchase a plan.
  2. Need access to .zip file
    If User do not have .ipa files and are looking to simply try App Automate, user can download our sample zip file
  3. To download sample zip file click the link below.

ArchiveXCTestPRod(1).zip

  1. Upload the sample zip file in the MyData section manually or using API.
  2. Upload your iOS app (.ipa) file on the pCloudy platform using an API request.

curl --location --request POST URL format:

curl -X POST -F "file=@/File_Path" -F "source_type=raw" -F "token=authToken" -F "filter=filter" <Cloud URL>/api/upload_file
Plain text

After the user uploads the app and test suite on the pCloudy platform, Use the below mentioned API's
1.Get Device list for iOS-This api is used to get iOS device list

Endpoint: request POST: {{URL}}/api/devices

Sample request

{
"token": "jmxbd3jvrdt74nzcjc43ccth",
"duration": 15,
"platform": "ios",
"available_now": "true"
}

Sample response

{
"result": {
    "token": "jmxbd3jvrdt74nzcjc43ccth",
    "code": 200,
    "models": [
        {
            "index": 1,
            "full_name": "Apple_iPhoneSE_Ios_11.2.5_58ce2",
            "id": 799,
            "alias_name": "58ce2",
            "model": "iPhoneSE",
            "display_name": "iPhone SE",
            "platform": "ios",
            "version": "11.2.5",
            "cpu": "Dual Core",
            "bucket": 3,
            "manufacturer": "Apple",
            "mobile_number": "",
            "dpi": "",
            "url": "https://device.pcloudy.com/device_images/small/iPhoneSE.png",
            "ram": 2048,
            "resolution": "640x1136",
            "display_area": 4,
            "available": true
        }
    ]
}
Plain text

}

2.Book Device API
This api book the devices for XCTest automation execution.

EndPoint : {{URL}}/api/automationbooking    
Plain text

Sample request

{
"token":"s85zmqdv3wfxgrp9x3btynbn ","devices":[783],"booking_duration": "30","automation_type": "XCUITest"}
Sample response
{
"result": "Devices are reserved successfully for the automation execution",
"statuscode": "200",
"data": {
"automationId": 440916
}
}

3.Initialize Automation
This API initiates the XCTest on devices for that test suite. The test suite you had to upload by using upload API which is available in Generic API.
}/api/api/initautomation

Sample request 
Plain text
{ "token":"s85zmqdv3wfxgrp9x3btynbn","automationId": "440916","test_suite": "ArchiveXCTestPRod(1).zip"}
Plain text

Sample response

{
"statuscode": 200,
"result": "Automation initiated successfully..."
Plain text

}

4.Start Device Services
This API helps to initialize device services on the device like device log, performance log, and session video recording.

EndPoint : {{URL}}/api/startdeviceservices
Plain text

Sample request

{"token":"s85zmqdv3wfxgrp9x3btynbn","automationId": "440925","startDeviceLogs": "true","startPerformanceData": "true","startSessionRecording": "true"}

Sample response

{
"statuscode": 200,
"result": "Device logs started successfully,Performance data started successfully,Session video recording started successfully"
Plain text

}

  1. Automation Report Shareable Link
EndPoint : {{URL}}/api/api/getAutomationShareableReportLink
Plain text
This API helps to share the automation reports to team.
Plain text

Note: Change the format of shreable link to JSON format.
Sample request

 {"token":"s85zmqdv3wfxgrp9x3btynbn","rid":"440925"}
Plain text

Sample response

{
"result": {
    "token": "s85zmqdv3wfxgrp9x3btynbn",
    "shareableLink": "https://device.pcloudy.com/execution_report/0?key=j8z8qjfjxmwqvcby73k4fn8p"
}
Plain text

}

  1. Release Device
    This API helps you to release the XCTest automation devices.
EndPoint : {{URL}}/api/api/automationrelease    
Plain text

Sample request

{"token":"s85zmqdv3wfxgrp9x3btynbn","automationId": "440925"}
Plain text

View test results

After you start an XCUI test-suite execution visit your Reports section to view your test results