Schedule Run Status API Endpoints
Below, we’ve listed out the existing route, the new route, and the functionality for the changed routes.
The following parameters are required to trigger the schedule in Sofy:
- x-sofy-auth-key: To retrieve your subscription key, navigate to Account > Account Settings > API Key.
- scheduledRunGuid: To retrieve your scheduledRunGuid as per the new route, navigate to Automation > Runs & Results and click on the CI/CD Settings integration icon next to the schedule name to capture the scheduledRunGuid.
Functionality
Fetch the status of a scheduled automated test run.
Schedule Run Status Route
curl --location "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/status/:testRunGroupId" `
--header "x-sofy-auth-key: XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Response:
{
"data": [
{
"scheduledRunName": "tomorrow",
"testRunGroupId": "XXXXXX",
"scenarioName": "alextest",
"scheduledAt": "2023-10-24T06:14:39.200Z",
"build": "1.43.0.release-candidate(5768)",
"device": "iPad 7th Gen",
"status": "Run Stopped"
}
],
"message": "Fetched 1 record(s)."
}
Error Response:
{
"error": {
"message": "Error message.",
"details": "Error details.",
"timestamp": "2023-10-23T09:23:51.845Z"
}
}
Triggering a Scheduled Build with a Specific Application Version
Using the App Hash copied from the steps in Capturing an Application Hash, use the following cURL command to trigger a scheduled build:
curl --location --request POST "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/execute?appHash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" `
--header "x-sofy-auth-key: XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\": SCHEDULED_ID,
\"AppHash\":\"APP_HASH_FROM_BUILD_UPLOAD\"
}"
Capturing an Application Hash
- Log in to your Sofy account.
- Select App Manager from the left navigation bar.
- Choose an app from the left panel.
- Select the Builds tab.
- Click the down-arrow icon to the left of the desired build name.
- Select the Copy Build ID two pages icon next to the build to copy the App Hash.
- Enter the copied App Hash Build ID in the \”AppHash\” parameter in the Scheduled Build API.
Status of Individual Test Runs of the Schedule
curl --location "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/status/:testRunGroupId" `
--header "x-sofy-auth-key: XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
--data-raw '{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\":SCHEDULED_ID,
\"ScheduleTestRunsGroupID\":SCHEDULE_TEST_RUNS_GROUP_ID
}'
ScheduleTestRunsGroupID is an optional parameter. If this parameter is not passed, the latest Schedule Test Run Group ID's results will be returned.
Response
[{
"Scheduled_Name": "****",
"ScenarioName": "******",
"ScheduledAt": "2022-10-07T20:39:26.02",
"Version": "*****",
"CodeName": "",
"BuildNumber": "****",
"Manufacturer": "Apple",
"Model": "iPhone13,2",
"Statusvalue": "Passed"
}]
Understanding the Test Run Status
- Not Executed: When a test case is executed, this status can be returned due to reasons like an internal server error.
- Incomplete: This test status is returned when the device is unavailable or the connection is lost or has failed.
- Passed: This status is returned when the test result has passed.
- Failed: This status is returned when the test result has failed.
- Stopped: This status is returned when the user force-stops the test.
- Running: This status is returned when execution is in progress.