Schedule Run Status API Endpoints

Updated by Jessica Holman

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.
    API Key settings page, with callouts over the navigation 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"
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\": SCHEDULED_ID
}"
Replace the placeholder authentication key, API key, and Scheduled ID values with the actual values.

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\"
}"
Replace the placeholder API key, Scheduled ID, and app hash values with the actual values.
Capturing an Application Hash
  1. Log in to your Sofy account.
  2. Select App Manager from the left navigation bar.
    Sofy home page with a callout over the App Manager option in the left navigation bar.
  3. Choose an app from the left panel.
  4. Select the Builds tab.
  5. Click the down-arrow icon to the left of the desired build name.
  6. Select the Copy Build ID two pages icon next to the build to copy the App Hash.
    App Manager build with a callout over the steps needed to copy the build ID.
  7. 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.

Replace the placeholder API key, Scheduled ID, and Schedule Test Runs Group ID values with the actual values.
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.


How did we do?