Framework for Mobile test automation (Native app and Browser) on Android and IOS devices

Overview

Appium Mobile Automation Framework

Framework for Mobile test automation (Native app and Browser) on Android and IOS devices ๐Ÿ“ฑ

๐Ÿš€ Quick Start - Appium set up on Windows (Android):

  1. Install Java JDK8 and IntelliJ IDEA
  2. Install NodeJS
  3. Install Android studio
  4. Install Appium Server using npm (CLI) command npm install -g appium. Appium server version 1.22.1
Command to check the installed appium version: `appium --version`
  1. Add below Android SDK path in the environment variable
    - ANDROID_HOME = <path to Sdk folder>
    - %ANDROID_HOME%\tools
    - %ANDROID_HOME%\tools\bin
    - %ANDROID_HOME%\platform-tools
  1. Install Appium desktop
  2. Install Appium Inspector

๐Ÿš€ Quick Start - Appium set up on MAC (Android):

  1. Install Homebrew
  2. Install NodeJS
  3. Install Java JDK8 and IntelliJ IDEA
  4. Install Appium server using npm (CLI) or Appium desktop client
  5. Install Android studio
  6. Install Appium Inspector
  7. Set JAVA_HOME and ANDROID_HOME environment variables

๐Ÿ“Œ Appium Doctor to verify the installations

  1. Install appium-doctor using command npm install -g appium-doctor
  2. To view the list of available options appium-doctor --help
To check Android set up `appium-doctor --android`
To check ios set up `appium-doctor --ios`

๐Ÿ“Œ Creating Android Virtual Device (Emulator) from Android Studio:

  1. Open Android Studio.
  2. Click on Tools -> AVD Manager -> Create Virtual Device -> Select the device and OS version -> Finish.
  3. Once Virtual device is created, click on Launch this AVD in the emulator.
  4. Command to view the list of devices attached adb devices

๐Ÿ“Œ Android Real Device Set up:

  1. Connect Android real device to the machine(Desktop/Laptop)
  2. Turn on the developer options in android mobile
  3. Enable USB debugging
  4. Run command adb devices in cmd prompt to check whether the device is recognised

๐Ÿ“Œ Mirror android/ios device to your desktop

  1. Download Vysor

๐Ÿ“Œ Start Android Emulator from Command line

  1. Open command prompt, go to
Command to stard AVD: `emulator -avd <avd_name>`
Command to stop/kill AVD: `adb -e emu kill`

๐Ÿ“Œ Pushing the App (.apk file) to Android Emulator:

  1. Copy the .apk file and paste it in the path -
  2. Open the cmd terminal from the directory when APK file is placed and enter command adb install <apk filename>

๐Ÿ“Œ Android - Finding appPackage and appActivity:

If the app is already installed on your device then we can make use of appPackage and appActivity to launch the app

Option 1:

  1. Open the app on the device, for which appPackage and appActivity is required.
  2. Open powershell and enter command adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp' NOTE: This command may not work for newer Android OS (10 or 11). In that case, use command: adb shell "dumpsys activity activities | grep mResumedActivity"

Option 2: Install APK info app to retrieve appPackage and appActivity for the app installed in your device

๐Ÿ“Œ Inspecting Elements

uiautomatorviewer

  1. Go to the path - <path to sdk folder>\tools\bin\
  2. click on uiautomatorviewer
  3. On the UI Automator Viewer, click on Device Screenshot (uiautomator dump). Ui automator will capture the screenshot of current open screen in the device.

UiAutomatorViewer

Appium Inspector

  1. Start the Appium Server and connect with Real device/Emulator.
  2. Open Appium Inspector app and provide the appium server details and Desired Capabilities.

Appium Inspector

  1. Click on Start session which will start the appium inspector with layout shown below.

Appium

๐Ÿ“Œ Inspecting Element for mobile web browser

Type url `chrome://inspect/#devices` in the desktop chrome browser and start inspecting element

Capture

๐Ÿ“Œ Launching Android Emulator Automatically

Add below lines in the Desired capabilities

capability.setCapability(AndroidMobileCapabilityType.AVD, "Pixel_3a");
capability.setCapability(AndroidMobileCapabilityType.AVD_LAUNCH_TIMEOUT, "180000");

๐Ÿ“Œ Auto Discovery of compatible ChromeDriver

Start appium server using command appium --allow-insecure chromedriver_autodownload

๐Ÿ“Œ Auto download of compatible ChromeDriver programmatically

Add below line in the AppiumServiceBuilder

AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.withArgument(GeneralServerFlag.ALLOW_INSECURE, "chromedriver_autodownload");

๐Ÿ“Œ Start Appium server programmatically

Use AppiumServiceBuilder and AppiumDriverLocalService to start the server programmatically Set environment variable APPIUM_HOME = <path to npm folder>\node_modules\appium\build\lib where main.js file is present

๐Ÿ“Œ Key Features

๐Ÿ‘‰ Supports Android and iOS Real Devices and Emulators.

๐Ÿ‘‰ Ability to start and stop the appium server on run-time. Configurable through config.properties

๐Ÿ‘‰ Supports capturing appium server logs on run-time.

๐Ÿ‘‰ Page object model design.

๐Ÿ‘‰ Supports parallel and sequential execution of tests.

๐Ÿ‘‰ Ability to capture screen(video) recording of tests on Android and iOS. Configurable through config.properties

๐Ÿ‘‰ Supports capturing screenshots for passed/failed/skipped steps which is configurable through config.properties

๐Ÿ‘‰ Ability to retry failed tests which is configurable through config.properties

๐Ÿ‘‰ Customised exception handling to provide the exceptions in a meaningful way.

๐Ÿ‘‰ Custom framework annotation to provide author name and category for each test.

๐Ÿ‘‰ Supports utilities to read test data from excel workbook and provides data to each test based on the test name.

๐Ÿ“Œ Running tests through Maven

๐Ÿ‘‰ Run test using command mvn test -Dsurefire.suiteXmlFiles=<provide the testng xml to execute>

๐Ÿ“Œ Running tests through testng xml

๐Ÿ‘‰ Create or Select the required testng xml -> Right click and select Run

๐Ÿ“Œ Custom Configurations in config.properties

Capture

๐Ÿ“Œ Report (Extent reports)

Web capture_24-1-2022_224531_

Web capture_24-1-2022_224634_

You might also like...
Quickly rotate screen on Android devices without second thought
Quickly rotate screen on Android devices without second thought

Useful uitlity for ONYX BOOX Eink devices. It provides several quick actions to be added in top system panel

A convenient BMI (Body Mass Index) calculator that is compatible with Android devices.
A convenient BMI (Body Mass Index) calculator that is compatible with Android devices.

๐Ÿ”– BMI Calculator A convenient BMI (Body Mass Index) calculator that is compatible with Android devices. ๐Ÿ–ฅ Please feel free to compute your BMI using

Simple App made for a test to Studio Sol Company

Studio Sol Test - Guess the Number Simple App made for a test to Studio Sol Company. #What you'll see in this project: ViewBinding Navigation Animatio

Nech9ev - Tinkoff Fintech test app
Nech9ev - Tinkoff Fintech test app

ะขะตัั‚ะพะฒะพะต ะทะฐะดะฐะฝะธะต ะฒ ะขะธะฝัŒะบะพั„ั„ ะคะธะฝั‚ะตั… ะกะบั€ะธะฝัˆะพั‚ั‹ Latest category Top category ะŸั€ะธะปะพะถ

Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

A project that takes advantage of docker and makes the load test easier

Performance Test It's a project that takes advantage of docker and makes the load test easier. Also, it collects metrics from each running container.

๐ŸŒฑ A test implementation of a Minecraft server using RESTful API taking advantage of the interoperability between Kotlin and Java.

๐ŸŒฑ Norin A test implementation of a Minecraft server using RESTful API taking advantage of the interoperability between Kotlin and Java. This project

Integration-test library for Kotlin and Java

Maya Maya (/หˆmษ‘หjษ™/, เคฎเคพเคฏเคพ), literally "illusion" or "magic". In Vedic texts it connotes a "magic show, an illusion where things appear to be present,

Owner
Thangaraj
Automation Consultant (SDET)
Thangaraj
Learn how to make an app designed for single-screen devices shine when running on foldable and dual-screen devices

dcberlin21-workshop Make your app shine om foldable devices with the samples we have here. Related links SDK open-source code SDK samples (Kotlin) App

Cesar Valiente 3 Oct 26, 2021
An introductory dynamics to Test Driven Development (TDD)An introductory dynamics to Test Driven Development (TDD)

tdd-demo Nesse hands-on teremos uma dinรขmica introdutรณria a Test Driven Development (TDD), ou desenvolvimento orientado por testes. instruรงรตes 1 - Clo

Plataforma Impact 1 Jan 15, 2022
Gha-central-test - GitHub Actions Maven Central Test

GitHub Actions Maven Central Test Pushing a tag does a release. Local Maven Depl

James Ward 1 Jan 19, 2022
A project that helps us generate the test project to test the Gradle plugin.

Ktlint Gradle Provides the function to generate a Gradle project for us to test your Gradle plugin Latest plugin version: [1.0.0] Table of content How

Jack Chen 5 Jul 20, 2022
Test Case Implementation From Nutrition-Framework

Android Architecture Blueprints v2 Android Architecture Blueprints is a project to showcase different architectural approaches to developing Android a

Faisal Amir 0 Feb 24, 2022
Test Case Implementation From Nutrition-Framework

About This Project (work-in-progress ?? ??๏ธ ??โ€โ™€๏ธ โ› ) Test Case Implementation Dari Nutrition Framework Version Release This Is Latest Release ~ Beta

Faisal Amir 0 Feb 24, 2022
Accessibility-Service - Filter url from browser by using accessibility service

Accessibility Service example Filter url from browser by using accessibility ser

AmirMohammad Yazdanmanesh 8 Nov 29, 2022
Native-Blur: a C++/Kotlin library for blur bitmaps and activity, mobile-ready, android compatible

Native-Blur The Native-Blur is a C++/Kotlin libraray for blur bitmaps and activity, mobile-ready, android compatible, powered by Java Native Interface

Abolfazl Abbasi 26 Dec 13, 2022
A Basic Call Recorder for rooted Android devices

Basic Call Recorder BCR is a simple Android call recording app for rooted devices or devices running custom firmware. Once enabled, it stays out of th

Andrew Gunnerson 420 Jan 7, 2023
A password list optimized for use on Android devices.

AndroidPWList A small (>1GB) password list optimized for use against Android device passwords. I do not condone, encourage, or support those who would

null 9 Jun 26, 2022