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 Espresso by directly calling the Browserstack API.
Run Espresso on Browserstack via Bitrise
If you want to run Espresso tests on a real device then you must build the android project testing so we need to add the 'Android Build for UI Testing' step then add a script runner to run the Browserstack script. See the workflow:
In this example, we are using a script to handle all the things required for running the Espresso tests on Browserstack. So it does the followings:
- Upload the app - debug.apk created by "Build for Test" step
- Upload the app - debug-androidTest.apk created by "Build for Test" step
- 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 "Android Build for UI Testing" so this step be set up correctly. We are using files that are added as environment variables: BITRISE_APK_PATH and BITRISE_TEST_APK_PATH
See the script to run the Espresso tests on Browserstack