Bitrise is one of the best solutions for mobile application development. It gives us many mobile app-related steps to create CI/CD (continuous integration / continuous deployment) pipelines (or workflows as in the Bitrise). Around the mobile application development ecosystem, we have many cloud solutions to make quick and reliable development processes. Browserstack is also one of them, it is widely used in web development and testing but also it also has nice features like 'App Live' and 'App Automate' for mobile app testing.
In this post, I want to share how we can integrate Browserstack to Bitrise to run XCUITest.
Run XCUITest on Browserstack via Bitrise
If you want to run XCUITest on a real device then you must build the for generic iOS devices. Building for generic iOS devices requires provisioning so you should ensure that you added the provisioning step to the workflow. Also to be able to run an iOS build on a real device, the device should be registered to the Apple console. This is required by Apple security concerns. However, device farms Firebase Test Lab and Browserstack handle this issue, so no need to be concerned about the limit of registered devices.
In this example, we are using a script to handle all the staff for us. So it does the followings:
- Create a .ipa file from the derived artifact
- ZIP the test file - UITests-Runner.app to UITests-Runner.zip
- Upload the app - .ipa created at Step-1
- Upload the test file - .zip file created at Step-2
- Trigger test with uploaded files and desired devices and test options
- Wait until tests to finish and evaluate the result
For the script, all the required files are created by the step "Xcode Build for testing for iOS" so this step be set up correctly. We are using file under "$BITRISE_TEST_DIR_PATH"
See the script to run XCUITest on Browserstack