Skip to main content

(Android) Run tests using the emulator

Description

Run any kind of tests (unit, instrumentation) on a local emulator instance.

Instructions

  1. Add an AVD Manager Step. To customize the emulator, see the Step configuration.

    Using the AVD Manager Step

    The AVD Manager starts in the background, which can take several minutes. Because of that, we recommend adding the AVD Manager Step at the beginning of your Workflow (before Activate SSH key (RSA private key) Step and the Git Clone Step) to speed up your builds.

  2. Add a Android Build for UI Testing Step, and configure the required inputs.

  3. Add a Wait for Android emulator Step.

  4. Add an Android Instrumented Test Step, and configure the required inputs.

  5. Add an Export test results to Test Reports add-on Step with the following inputs:

    • The name of the testEmulator tests.

    • Test result base path$BITRISE_SOURCE_DIR/app/build/outputs/androidTest-results.

      You might want to adjust the path based on the module name(s) in your project.

    • Test result search pattern*.xml.

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

bitrise.yml

- [email protected]: {}
- [email protected]:
        inputs:
        - module: "$ANDROID_TESTING_MODULE"
        - variant: "$ANDROID_V_DEBUG"
- [email protected]:
- [email protected]: {}
- [email protected]:
    inputs:
    - search_pattern: "*.xml"
    - base_path: $BITRISE_SOURCE_DIR/app/build/outputs/androidTest-results
    - test_name: Emulator tests
- [email protected]: