Sofy integration
How to integrate your workflows with Sofy using codemagic.yaml
Sofy is a testing automation platform that uses testing capabilities to enable tests without writing a single line of code. It is possible to publish binaries generated by Codemagic and schedule automation tests with Sofy via codemagic.yaml
.
A sample project that shows how to configure Sofy integration is available in our Sample projects repository.
Configuring Sofy access
You will need to sign up with Sofy so you can obtain an API Key which is required for deploying your apps via Codemagic. In addition, you will also need the Sofy subscription key and the Schedule ID, both obtainable from your Sofy account settings.
Open your Codemagic app settings, and go to the Environment variables tab.
Enter the desired Variable name, e.g.
SOFY_API_KEY
.Copy and paste the API key string as Variable value.
Enter the variable group name, e.g. sofy_credentials. Click the button to create the group.
Make sure the Secure option is selected.
Click the Add button to add the variable.
Repeat the steps to also add
SOFY_SUBSCRIPTION_KEY
,SOFY_SCHEDULE_ID
, and$SOFY_SCHEDULE_GUID
variables.Add the variable group to your
codemagic.yaml
fileenvironment: groups: - sofy_credentials
Real Time and App Automation
The following examples show how to use cURL commands in your codemagic.yaml
to deploy and test your app with Sofy.
Uploading apps
scripts:
- name: Publish APK / AAB / IPA to Sofy
script: |
curl --location "https://public.sofy.ai/parser-microservice/build-upload" \
--header "x-sofy-auth-key: $SOFY_SUBSCRIPTION_KEY" \
--form "applicationFile=@/build/app/outputs/flutter-apk/app-release.apk" \
Uploading apps with Certificate Name (if any) for iOS builds
scripts:
- name: Publishing IPA with a Certificate name
script: |
curl --location "https://public.sofy.ai/parser-microservice/build-upload" \
--header "x-sofy-auth-key: $SOFY_SUBSCRIPTION_KEY" \
--form "applicationFile=@build/ios/ipa/native_ios_app.ipa" \
--form 'CertificateName=""'
Uploading apps with Application Guid (linking application)
scripts:
- name: Publishing APK with Application Guid
script: |
curl --location "https://public.sofy.ai/parser-microservice/build-upload" \
--header "x-sofy-auth-key: SOFY_SUBSCRIPTION_KEY" \
--form "applicationFile=@/build/app/outputs/flutter-apk/app-release.apk" \
--form 'ApplicationGUID=""'
Scheduling automation tests
scripts:
- name: Schedule an automation test with Sofy
script: |
curl --location --request POST "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/execute" \
--header "x-sofy-auth-key: SOFY_SUBSCRIPTION_KEY"
Scheduling automation tests on a particular build using application hash
scripts:
- name: Schedule an automation test (on a specific build) with Sofy
script: |
curl --location --request POST "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/execute?appHash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
--header "x-sofy-auth-key: SOFY_SUBSCRIPTION_KEY"
Fetching test run group IDs
scripts:
- name: Fetch test run group IDs with Sofy
script: |
curl --location "https://public.sofy.ai/scheduler-microservice/scheduled-runs/$SOFY_SCHEDULE_GUID/test-run-groups" \
--header "x-sofy-auth-key: SOFY_SUBSCRIPTION_KEY"
Checking the status of scheduled tests
scripts:
- name: Checking the status of scheduled tests
script: |
curl --location "https://public.sofy.ai/scheduler-microservice/scheduled-runs/$SOFY_SCHEDULE_GUID/status/:testRunGroupId" \
--header "x-sofy-auth-key: SOFY_SUBSCRIPTION_KEY"
:testRunGroupId
will be replaced by test run group ID fetched from the response of the Fetching test run group IDs
step above.As soon as your .ipa and .apk are successfully built, they will appear in the Sofy UI and any preferred devices can be selected for testing with Real Time. If devices need to be pre-chosen, then some capabilities provided by Sofy device settings must be injected into your project’s test scripts first.