Quality Assurance

How to setup android emulator

  • What do we need?

  • Introduction into appium

  • How to run Webdriver IO tests on android emulator

AGENDA

Download and install android studio

First, we need to download and install Android Studio. Then go through Android Studio setup.

FIRST LOOK ON ANDROID STUDIO

Let's create a first emulator

Click on the plus button or create a new device and select pixel 4 as an emulator.

Select hardware

Select Pixel 4 device

Select any version of Android but it should be with Google APIs at the end like on the screenshot.

 JDK setup and configure zshrc file 

Add the following Java Path in zshrc file

The Java Development Kit is a distribution of Java technology by Oracle Corporation. It implements the Java Language Specification and the Java Virtual Machine Specification and provides the Standard Edition of the Java Application Programming Interface.

Introduction into Appium

Appium is an open-source project and ecosystem of related software, designed to facilitate UI automation of many app platforms, including mobile (iOS, Android, Tizen), browser (Chrome, Firefox, Safari), desktop (macOS, Windows), TV (Roku, tvOS, Android TV, Samsung), and more!

Appium setup

1. npm install -g appium@next
2. appium driver install xcuitest
3. appium driver install uiautomator2

4. Start appium:

appium —relaxed-security —base-path /wd/hub

Start and add host to emulator

Run via the terminal the following command to start the emulator:

emulator -avd Native_API_33 -writable-system -noaudio -no-cache -no-snapshot-save

CREATE HOST

127.0.0.1       localhost
::1             ip6-localhost
10.0.2.2        home.tc.loc
10.0.2.2        api.tc.loc
127.0.0.1       home.tc.loc
127.0.0.1       api.tc.loc

Push host to Android emulator:

1. adb root
2. adb remount
3. adb push /Users/user/Desktop/andHost /etc/hosts

Run test on Android emulator

Navigate to WDIO project and find any test then copy the command and run it via terminal.

Each test has a description with a command but additional commands can be found in package.json

Welcome to mobile

We're excited to have you join as our new Automation QA wizard 🧙‍♂️. Your skills will make a big impact on our mobile project. Let's make this journey as fun and successful as possible!