• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Plugin dedicated for Android platform. Wraps gradle task/shell command used for launching instrumented tests. Provides start of as many AVDs with various configs as needed before test run, waits for boot, kills emulators and deletes them from hdd after tests are finished or disturbed.

automated_test_emulator_run plugin

fastlane Plugin Badge

(article is deprecated - covered plugin version < 1.3.2 which doesn't support Build-Tools ver. >= 25.0.2)
See blog post related to this plugin. You can learn there how to create basic setup for this plugin step by step.

About automated_test_emulator_run

Starts any number of AVDs. AVDs are created and configured automatically according to user liking before instrumentation test process starts (started either via shell command or from gradle) and killed/deleted after test process finishes.

Getting Started

This project is a fastlane plugin.

  1. To get started with fastlane-plugin-automated_test_emulator_run, add it to your project by running:
fastlane add_plugin automated_test_emulator_run
  1. Create your *.JSON config file to create AVD launch plan according to schema below/provided example.

  2. Wrap your test launch command with plugin and provide link to *.JSON config.

Example of Fastfile

Check out the example Fastfile to see how to use this plugin. Try it by cloning the repo, running fastlane install_plugins and bundle exec fastlane test.

JSON config

What is JSON config?

It is a core of this plugin. User can specify any number of AVD devices in JSON file. Each AVD can be configured separately. Plugin will read JSON file and create fresh, new, untouched AVDs on host - use them in tests - and then delete them after test process finishes.

JSON file scheme:

{
    "avd_list":
    [
        {
          "avd_name": "",

          "create_avd_package": "",
          "create_avd_device": "",
          "create_avd_tag": "",
          "create_avd_abi": "",
          "create_avd_additional_options": "",
          "create_avd_hardware_config_filepath": "",

          "launch_avd_port": "",
          "launch_avd_snapshot_filepath": "",
          "launch_avd_launch_binary_name": "",
          "launch_avd_additional_options": ""
        }
    ]
}

Parameters:
For official help refer to avdmanager binary file: <sdk_root>/tools/bin/avdmanager create avd

  • avd_name - name of your AVD, avoid using spaces, this field is necessary
  • create_avd_package - path to system image in example "system-images;android-23;google_apis;x86_64"
  • create_avd_device - name of your device visible on avdmanager list device list
  • create_avd_tag - the sys-img tag to use for the AVD. e.g. if you are using Google Apis then set it to "google_apis"
  • create_avd_abi - abi for AVD e.g. "x86" or "x86_64" (https://developer.android.com/ndk/guides/abis.html)
  • create_avd_hardware_config_filepath - path to config.ini file containing custom config for your AVD. After AVD is created this file will be copied into AVD location before it launches.
  • create_avd_additional_options - if you think that you need something more you can just add your create parameters here (e.g. "--sdcard 128M", https://developer.android.com/studio/tools/help/android.html)
  • launch_avd_snapshot_filepath - plugin might (if you set it) delete and re-create AVD before test start. That means all your permissions and settings will be lost on each emulator run. If you want to apply qemu image with saved AVD state you can put path to it in this field. It will be applied by using "-wipe-data -initdata "
  • launch_avd_launch_binary_name - depending on your CPU architecture you need to choose binary file which should launch your AVD (e.g. "emulator", "emulator64-arm")
  • launch_avd_port - port on which you wish your AVD should be launched, if you leave this field empty it will be assigned automatically
  • launch_avd_additional_options - if you need more customization add your parameters here (e.g. "-gpu on -no-boot-anim -no-window", https://developer.android.com/studio/run/emulator-commandline.html)

Note:

  • parameter --path is not supported, if you want to change directory to where your AVD are created edit your env variable ANDROID_SDK_HOME. Which is set to ~/.android/avd by default.

Hints:

  • After change from android bin to avdmanager bin, default settings of AVD created from terminal has changed. No resolution is set. We highly recommend to use config.ini files which you can set to create_avd_hardware_config_filepath or specify resolution in create_avd_additional_options.
  • all fields need to be present in JSON, if you don't need any of the parameters just leave it empty
  • pick even ports for your AVDs
  • if you can't launch more than 2 AVDs be sure to check how much memory is your HAXM allowed to use (by default it is 2GB and that will allow you to launch around 2 AVDs) If you face any problems with freezing AVDs then be sure to reinstall your HAXM and allow it to use more of RAM (https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager)
  • make sure you have all targets/abis installed on your PC if you want to use them (type in terminal: android list targets)
  • we recommend adding -gpu on to your launching options for each device, it helps when working with many AVDs

Example:

Example of complete JSON file can be found here.

Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting doc in the main fastlane repo.

Using fastlane Plugins

For more information about how the fastlane plugin system works, check out the Plugins documentation.

About fastlane

fastlane is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out fastlane.tools.

Towards financial services available to all

We’re working throughout the company to create faster, cheaper, and more available financial services all over the world, and here are some of the techniques that we’re utilizing. There’s still a long way ahead of us, and if you’d like to be part of that journey, check out our careers page.

More Repositories

1

AndroidKeyboardWatcher

Software keyboard open/close watcher for Android.
Java
845
star
2

ConditionWatcher

Android tool which helps to synchronise application behaviours with test thread in automation tests.
Java
218
star
3

MaskFormatter

Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.
Java
160
star
4

Review-Reporter

Bot for reporting Google Play Reviews on Slack with possibility to fast reply and creating Jira issues from low rating reviews.
Java
135
star
5

apple-sign-in-php-sdk

PHP library to verify and validate Apple IdentityToken and authenticate a user with Apple ID.
PHP
89
star
6

Language-Switcher-Tile

An android plugin that allows you to easily change your device language.
Java
78
star
7

Api-Error-Handler

Declare expected errors of your API and generate implementing code automatically.
Java
67
star
8

AutomationTestSupervisor

Python tool for launching and managing Android Virtual Devices and Android Automation Tests. It provides elastic configurations, test and launch profiles, test video recording, html log generation and more.
Python
42
star
9

SMFloatingLabelTextField

A subclass of UITextField that displays floating placeholder
Swift
37
star
10

RxTesting

Application with examples of test cases for Android Rx code.
Java
31
star
11

WebViewTester

Android tool to automate interaction with web pages displayed in Android WebViews. Could be especially helpful in testing UI with Espresso.
Java
29
star
12

kafka-to-avro-writer

Kafka to Avro Writer based on Apache Beam. It's a generic solution that reads data from multiple kafka topics and stores it on in cloud storage in Avro format.
Java
25
star
13

scala-updatable-config

Library based on pure-config for getting updates from Consul or Vault backend.
Scala
23
star
14

CustomScrollActions

Sample project presenting how to deal with NestedScrollView in UiAutomation tests done with Espresso framework.
Java
18
star
15

AzimoTestKit

Supporting framework for writing unit tests in Swift
Swift
16
star
16

SMSecureTaskSwitcher

Use custom view for application preview in iOS Task Switcher
Objective-C
13
star
17

SimpleBDD

Simple library for tests in BDD style, written with Objective-C.
Objective-C
10
star
18

braze-templates-cli

Simple CLI tool written in Deno for creating a back-up of Braze templates and content blocks.
TypeScript
7
star
19

AzimoNote

Very simple small app that allows you to register users and store message notes bound to their profiles. Created in order to show how to setup AutomationTestSupervisor with real Android project.
Java
6
star
20

service-homescreen-aggregator

Based on our homescreen aggregator project we are showing examples for various implementation mechanisms like DynamoDB polymorphic model or rules engine etc.
Java
3
star
21

MobileInternshipTask

Programming task for mobile internship candidates
3
star
22

AppStoreConnectAPIClient

Swift
3
star
23

DecisionEngine

Example project showing basics behind our Decision Engine, built on top of Shapeless and Scala.
Scala
2
star
24

avro-rewriter

Reads, transforms and writes avro files written on Google Cloud Storage with use of Generic Avro Records.
Java
2
star
25

paloalto-gsuite

GlobalProtect authentication using SAML from G Suite
Shell
2
star
26

extend-camunda-dmn-juel-with-java-functions

This example contains ready to run Spring Boot application with Camunda where JUEL expression language is extended.
Java
1
star
27

daggerextensions

Java
1
star