(Android) Run tests using the emulator
Description
Run any kind of tests (unit, instrumentation) on a local emulator instance.
Instructions
-
Add an AVD Manager Step. To customize the emulator, see the Step configuration.
-
Add a Wait for Android emulator Step.
-
Add a Gradle Runner Step. Set the input variables:
-
Gradle task to run: for example,
connectedDebugAndroidTest
. -
gradlew file path: for example,
./gradlew
.
-
-
Add an Export test results to Test Reports add-on Step with the following inputs:
-
The name of the test:
Emulator 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
.
-
-
Add a Deploy to Bitrise.io Step that makes the test results available in the Test Reports add-on.
bitrise.yml
- avd-manager@1: {} - wait-for-android-emulator@1: - gradle-runner@2: inputs: - gradlew_path: ./gradlew - gradle_task: connectedDebugAndroidTest - custom-test-results-export@0: inputs: - search_pattern: "*.xml" - base_path: $BITRISE_SOURCE_DIR/app/build/outputs/androidTest-results - test_name: Emulator tests - deploy-to-bitrise-io@2: