Upload your .app directory
EarlGrey tests are the unit tests based on XCTest framework, you just need to upload your .app directory which will contain your app as well as the test suite for the app.
Follow below steps to create a zip of your .app directory and upload using the REST API.
If you are using XCode to build your app and write EarlGrey tests:
-
From the schemes dropdown, select the app scheme, and device as “Generic iOS device”
-
Product → Clean (Cmd Shift K)
-
Product → Build For → Testing (Cmd Shift U)
-
Use Xcode’s Project Navigator to right click on .app and navigate to “Show in Finder” option
-
Create a zip of the .app directory and upload using the below REST API
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -X POST "https://api-cloud.browserstack.com/app-automate/earlgrey/app-dir" -F "file=@/path/to/app/file/appDir.zip"
Sample response:
{"test_url":"bs://<hashed testID>"}
The Test ID returned in the response will be used to execute your test.
Note: If you do not have an EarlGrey suite and looking to simply try EarlGrey on App Automate, you can download our Sample EarlGrey App and upload to the BrowserStack servers using the above API. Refer to our sample test repo - earlgrey-sample-browserstack
Note: If you do not have an EarlGrey suite and looking to simply try EarlGrey on App Automate, you can download our Sample EarlGrey App and upload to the BrowserStack servers using the above API. Refer to our sample test repo - earlgrey-sample-browserstack
Upload zip from a Public Location
If you do not have your zip file on the local machine from where you are running the test and it is hosted on a different location, you can upload it to the BrowserStack servers from any public hosted location. You can achieve that by just providing the zip public url in the API call to upload an zip. The url should be accessible over the internet so that BrowserStack can directly upload it from that location. Use the below API call to upload zip from a publicly accessible location.
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -X POST "https://api-cloud.browserstack.com/app-automate/earlgrey/app-dir" -F "data={"url": "https://www.browserstack.com/app-automate/sample-apps/ios/BStack-EarlGrey-SampleApp.zip"}"
Define Custom ID for your test:
You can choose to set a custom_id for your test suite. You can use this custom_id while executing the test. Every time you upload a test with the same custom test id, the test execution will pick the last uploaded test suite for the custom_id you used. Custom ID is optional.
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -X POST "https://api-cloud.browserstack.com/app-automate/earlgrey/app-dir" -F "file=@/path/to/app/file/appDir.zip" -F "data={"custom_id": "MyTest"}"
Sample response:
{"test_url":"bs://<hashed appID>", "custom_id":"MyTest", "shareable_id":"YOUR_USERNAME/MyTest"}
The maximum character limit in the custom_id parameter is 100 and the characters allowed are a-z, A-Z, 0-9, period(.), underscore(_), and hyphen(-).
You can use either of the above values for the test suite while executing a test.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!