Skip to main content

(Android) Run instrumentation tests on virtual devices

Description

Run instrumentation (for example, Espresso) or robo/gameloop tests on virtual devices. Our device testing solution is based on Firebase Test Lab. You can find the resulting logs, videos and screenshots on Bitrise.

Instructions

  1. Add an Android Build for UI Testing Step. Set the input variables:

    • Project Location: Use the default $BITRISE_SOURCE_DIR or $PROJECT_LOCATION. You can set a specific path but the automatically exposed Environment Variables are usually the best option.

    • Variant: Use the $VARIANT Enviromment Variable, or specify a variant manually.

    • Module: Specify one or leave it blank to run tests in all of the modules.

  2. Add a Virtual Device Testing for Android Step. Set the input variables:

    • Test typeinstrumentation (or robo or gameloop)

    • (Optional) Test devices (default: NexusLowRes,24,en,portrait).

  3. Add a Deploy to Bitrise.io Step that makes the test results available in the Test Reports add-on.

Potential issues with running instrumentation tests on virtual devices

You might encounter some unexpected issues while running instrumentation tests on virtual devices. You can find some examples and possible solutions in our Knowledge Base:

bitrise.yml

- android-build-for-ui-testing@0:
    inputs:
    - variant: $VARIANT
    - module: $MODULE
- virtual-device-testing-for-android@1:
    inputs:
    - test_type: instrumentation
- deploy-to-bitrise-io@2: {}