Skip to content

arjityadavv/Appium-Mobile-Automation-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appium-Mobile-Automation-Framework

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

image

🚀 Quick Start - Appium set up on Windows (Android):

  1. Install Java JDK11 and Eclipse IDE
  2. Install NodeJS
  3. Install Android studio
  4. Install Appium Server using npm (CLI) command npm install -g appium. Appium server version 2.12.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 Inspector

📌 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 (How to do it?)
  3. Enable USB debugging
  4. Run command adb devices in cmd prompt to check whether the device is recognised

📌 Start Android Emulator from Command line

  1. Open command prompt, go to <sdk emulator path>
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 - <path to sdk platform-tools>
  2. Open the cmd terminal from the directory where 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

  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'

📌 Inspecting Elements

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.

image

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

image

📌 Inspecting Element for mobile web browser

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

📌 Launching Android Emulator Automatically

Add below lines in the Desired capabilities

options.setAvd("ArjitPhone");
or there is another method name - checkAndStartEmulator(deviceName, deviceId) in the CommonUtils Class

📌 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

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 - Real Devices and Emulators.

👉 Ability to start and stop the appium server on run-time.

👉 Page object model design.

👉 Supports capturing screenshots for failed steps

👉 Supports utilities to read test data from json file and provides data to each test based on the test name.

📌 Running tests through Maven

👉 Run test using command mvn test -Dgroups=<provide the group tag name to execute>

📌 Running tests through testng xml

👉 Create or Select the required testng xml -> Right click and select Run

📌 Report (Extent reports)

image

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages