Currently supported use cases for the Android platform
We have prepared some Pipeline recipes based on common Android use cases. These contain some of the most frequent tasks our users need to run. The examples include entire Workflows that can be copied and pasted for the most part.
(Android) Run UI tests in parallel on multiple devices or shardsClick to copy link
DescriptionClick to copy link
Running the UI (instrumentation) tests of a single module in parallel Workflows utilizing pipelines. You can run the tests in parallel by shards or by devices.
The Pipeline contains two Stages that are run serially:
-
build_for_ui_testing: This Stage executes a Workflow — also namedbuild_for_ui_testing— that runs theandroid-build-for-ui-testingStep to build APKs for use in testing, and runs thedeploy-to-bitrise-ioStep to save those APKs for use in the later Stages. Performing this Stage separately from the actual testing allows for each test Stage to use these pre-built APKs rather than having to rebuild them for each test Stage. -
run_ui_tests_on_devices: This Stage executes three UI test Workflows in parallel —ui_test_on_phone,ui_test_on_tablet,ui_test_on_foldable— which use theandroid-instrumented-testStep to run the UI tests on the APKs built in the previous Workflow on each specific device type.
InstructionsClick to copy link
To test this configuration in a new Bitrise example project, do the following:
- Visit the Create New App page to create a new App.
- When prompted to select a git repository, choose Other/Manual and paste the sample project repository URL (
https://github.com/bitrise-io/Bitrise-Android-Modules-Sample.git) in the Git repository (clone) URL field. - Confirm that this is a public repository in the resulting pop-up.
- Select the
mainbranch to scan. - Wait for the project scanner to complete.
- Enter
appas the specified module. - Enter
debugas the specified variant. - Continue through the prompts as normal — no changes are needed.
- Open the new Bitrise project’s Workflow Editor.
- Go to the bitrise.yml tab, and replace the existing yaml contents with the contents of the example
[bitrise.yml](https://github.com/bitrise-io/workflow-recipes/blob/main/recipes/android-parallel-ui-tests-on-multiple-devices.md#bitriseyml). - Click the Start/Schedule a Build button, and select the
ui_test_on_multiple_devicesoption in the Workflow, Pipeline dropdown menu at the bottom of the popup.
bitrise.ymlClick to copy link
(Android) Running unit and UI tests in parallelClick to copy link
DescriptionClick to copy link
Run unit tests and UI tests in parallel utilizing Pipelines.
This Pipeline contains one Stage — stage_unit_and_ui_test — that executes two Workflows in parallel:
-
unit_tests: This Workflow simply runs the unit tests of the given module and variant using theandroid-unit-testStep. -
ui_tests: This Workflow builds the given module and variant using theandroid-build-for-ui-testingStep, spins up an emulator using theavd-managerStep, waits for the emulator to boot using thewait-for-android-emulatorStep, and runs the UI tests using theandroid-instrumented-testStep.
InstructionsClick to copy link
- Visit the Create New App page to create a new App.
- When prompted to select a git repository, choose Other/Manual and paste the sample project repository URL (
https://github.com/bitrise-io/Bitrise-Android-Modules-Sample.git) in the Git repository (clone) URL field. - Confirm that this is a public repository in the resulting pop-up.
- Select the
mainbranch to scan. - Wait for the project scanner to complete.
- Enter
appas the specified module. - Enter
debugas the specified variant. - Continue through the prompts as normal — no changes are needed.
- Open the new Bitrise project’s Workflow Editor.
- Go to the bitrise.yml tab, and replace the existing yaml contents with the contents of the example
[bitrise.yml](https://github.com/bitrise-io/workflow-recipes/blob/main/recipes/android-parallel-unit-and-ui-tests.md#bitriseyml). - Click the Start/Schedule a Build button, and select the
pipeline_unit_and_ui_testoption in the Workflow, Pipeline dropdown menu at the bottom of the popup.
bitrise.ymlClick to copy link
GitHub link: https://github.com/bitrise-io/workflow-recipes/blob/main/recipes/android-parallel-unit-and-ui-tests.md#bitriseyml
(Android) Unit test sharding by moduleClick to copy link
DescriptionClick to copy link
Run the unit tests of a modularized app in parallel Workflows utilizing Pipelines.
This Pipeline contains one Stage — stage_unit_test — that executes two Workflows in parallel:
-
unit_test_app: This Workflow runs the unit tests of the app module using theandroid-unit-testStep. -
unit_test_library: This Workflow runs the unit tests of thelib-examplemodule using theandroid-unit-testStep.
InstructionsClick to copy link
- Visit the Create New App page to create a new App.
- When prompted to select a git repository, choose Other/Manual and paste the sample project repository URL (
https://github.com/bitrise-io/Bitrise-Android-Modules-Sample.git) in the Git repository (clone) URL field. - Confirm that this is a public repository in the resulting pop-up.
- Select the
mainbranch to scan. - Wait for the project scanner to complete.
- Enter
appas the specified module. - Enter
debugas the specified variant. - Continue through the prompts as normal — no changes are needed.
- Open the new Bitrise project’s Workflow Editor.
- Go to the bitrise.yml tab, and replace the existing yaml contents with the contents of the example
[bitrise.yml](https://github.com/bitrise-io/workflow-recipes/blob/main/recipes/android-parallel-testing-unit-test-shards.md#bitriseyml). - Click the Start/Schedule a Build button, and select the
pipeline_unit_testoption in the Workflow, Pipeline dropdown menu at the bottom of the popup.