Schedule Run Status API
How to use Schedule APIs
The below curls are components of schedule APIs.
Schedule Curl
The schedule curl is used to trigger tests in Sofy. The following parameters are required to trigger the schedule in Sofy.
SUBSCRIPTION_API_KEY: To retrieve your subscription key, navigate to Account --> API Key
SCHEDULED_ID: To retrieve your SCHEDULED_ID, navigate to Automation --> Schedule Runs --> Click on the CI/CD integration icon on the schedule to capture the schedule ID.
curl --location --request POST "https://api.sofy.ai/api/CICD/ScheduleAutomatedTestRun" \
--header "Content-Type: application/json" \
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\": SCHEDULED_ID
}"
Sample Response
ScheduleTestRunsGroupID is the ID returned in response. It can be used to retrieve the status of the schedule runs. Above API will always trigger the schedule with latest available build.
{
"Message": "Test runs are scheduled and in queue, Login to https://portal.sofy.ai for more info.",
"ScheduleTestRunsGroupID": *******
}
Trigger a schedule a build with specific version of application
To view how to capture APP Hash click here
curl --location --request POST "https://api.sofy.ai/api/CICD/ScheduleAutomatedTestRun" \
--header "Content-Type: application/json" \
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\": SCHEDULED_ID,
\"AppHash\":\"APP_HASH_FROM_BUILD_UPLOAD\"
}"
Schedule Status API
Status Curl uses ScheduleTestRunsGroupID
to fetch the status of the schedule run.
curl --location --request POST "https://api.sofy.ai/api/CICD/ScheduleAutomatedTestRunStatus?ScheduleTestRunsGroupID=SCHEDULED_TESTRUN_GROUP_ID" \
--header "Content-Type: application/json" \
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\":SCHEDULED_ID
}"
Sample Response
[{
"ScheduleTestRunsGroupID": ******,
"ScheduleTestRunsGroupStatus": "Running"
}]
Different ScheduleTestRunsGroupStatuses possibly returned by the API are as follows:
- Queued: Scheduled has been submitted to scheduler and is awaiting device acquisition.
- Running: Device acquired and test execution has kicked off.
- Complete: Execution completed successfully. Test case results may be Pass or Fail.
- Complete with errors: Execution completed but with statuses other than Pass or Fail for individual test runs. This includes—but is not limited to—"Not Executed" or "Incomplete".
Fetch Schedule Test Run Group ID API
Status Curl uses fetchTestRunGroupIDs
to fetch the schedule test run group ID. A schedule test run group ID is generated each time a schedule is executed.
curl --location --request POST "https://api.sofy.ai/api/CICD/fetchTestRunGroupIDs" \
--header "Content-Type: application/json" \
--data-raw "{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\":SCHEDULED_ID
}"
Sample Response
[{
"TestRunGroupID": "XXXXXX",
"ExecutedAt": "YYYY-MM-DDTHH:MM:SS.XXXZ",
"ScheduledRunSvgStatus": "Complete"
},
{
"TestRunGroupID": "XXXXXX",
"ExecutedAt": "YYYY-MM-DDTHH:MM:SS.XXXZ"
"ScheduledRunSvgStatus": "Complete With Errors"
},
{
"TestRunGroupID": "XXXXXX",
"ExecutedAt": "YYYY-MM-DDTHH:MM:SS.XXXZ"
"ScheduledRunSvgStatus": "In Queue"
}]
Status of Individual Test Runs of the schedule
curl --location --request POST 'https://api.sofy.ai/api/CICD/ScheduleAutomatedTestRunStatus' --header 'Content-Type: application/json'
--data-raw '{
\"APIKey\":\"SUBSCRIPTION_API_KEY\",
\"ScheduledID\":SCHEDULED_ID,
\"ScheduleTestRunsGroupID\":SCHEDULE_TEST_RUNS_GROUP_ID
}'
Note: 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"
}]
- 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 device is unavailable or the device 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.