Logo

Terms and Conditions

Blog

Test Management System

Created with ❤️ by Clean Cut Kft. - 2025

DiscordYouTube
This is only a Test
/Curriculum
Curriculum
/
Testautomation
/
Appium
/
Prerequisites:

Prerequisites:

As we here test mobile applications, we need to set up some additional tools:

  • Java JDK (11 or 17+) – Appium’s Android driver uses Java tooling.
    • side note: the latest version is JDK 24. So why we use 17? Because it’s the most widely tested combo today. The “latest” (e.g., JDK 24) is a non-LTS release and some Android tools/drivers can be picky with bleeding-edge Java versions. LTS releases (11, 17, 21) get long-term fixes and are what Android tooling and Appium ecosystems are validated against most.
  • Android SDK / Android Studio – gives you the emulator (AVD) and adb.
  • Appium 2 + Android driver (UiAutomator2) – the server Appium runs.

Install Java JDK 17

  • https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
  • in VS Code open a new terminal (terminal and the + icon) and verify:
java -version
javac -version

Common issue: “java is not recognized” on Windows.

If you face this problem, here’s teh solution and the explanation why could it occur:

Running

java -version
javac -version

returned “not recognized” (or pointed to Common Files\Oracle\Java\javapath...).

Why: Windows PATH/JAVA_HOME wasn’t set to the real JDK folder; sometimes installers add only a forwarder (javapath_*) which isn’t a true JDK home.

You can easily auto-find and set the right path with PowerShell:

  • Find the real javac.exe outside any 'javapath' folder, by running the below lines:
  • $realJavac = Get-ChildItem 'C:\Program Files','C:\Program Files (x86)' -Recurse -Filter javac.exe -ErrorAction SilentlyContinue |
      Where-Object { $_.FullName -notmatch 'javapath' } |
      Select-Object -First 1 -Expand FullName
  • Derive the JDK root from that path
  • $realRoot = Split-Path -Parent (Split-Path -Parent $realJavac)
  • Set user env vars
  • setx JAVA_HOME "$realRoot"
    setx PATH "$($env:PATH);%JAVA_HOME%\bin"
  • for verification, open a new terminal:
  • java -version
    javac -version
    $env:JAVA_HOME

Expected result:

  • java -version → 17.x (LTS)
  • javac -version → 17.x
  • JAVA_HOME → your JDK folder, e.g. C:\Program Files\Java\jdk-17.0.12

Java is correctly configured on Windows. We can now install Android tools (Android Studio/SDK), create an emulator, and move on to Appium.

Installing Android Studio

downlad and install Android Studio:

Android Developers Download Android Studio & App Tools - Android DevelopersAndroid Developers Download Android Studio & App Tools - Android Developers

Once installed, open the SDK Manager under More Actions

Install/ensure:

  • Android SDK Platform (API 34 is fine)
  • Android SDK Platform-Tools (gives adb)
  • Android Emulator

Switch to SDK Tools tab:

  • Tick Android SDK Platform-Tools (gives adb)
  • Tick Android Emulator
  • (optional but nice) Android SDK Command-line Tools (latest)

Create & start an emulator

  • Back on the Welcome screen: More Actions ▾ → Virtual Device Manager (or Device Manager).
  • Create Device… → choose Pixel 5 (any Pixel is fine).
  • Pick a Google APIs (or Google Play) system image for your API (e.g., API 34), click Download if needed, then Next → Finish.
  • In Device Manager, click Start (►) to launch the emulator.
If you may fail with an error message with “Android Hypervisor driver is not installed”, click here and open for the resolution.

Installing Appium 2 (server + driver)

Just like PlayWright, Appium is a Node package, so we install it with npm.

Open PowerShell and run:

npm i -g appium               
appium -v                      
appium driver install uiautomator2 

Then start the server in its own terminal:

appium

Keep the current PowerShell window open running Appium.

Open your test folder in VS Code (appium_test)

Paste in the terminal:

npm init -y
npm i -D selenium-webdriver mocha chai

Open package.json, ctrl+a and set:

Create a tests folder, and in a new file: mobile_web.spec.js, and set:

Then run the test, and see it running through your emulator, openin Android Chrome and navigated to example.org.

{
  "name": "appium_test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha tests/**/*.spec.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "chai": "^4.4.1",
    "mocha": "^10.4.0",
    "selenium-webdriver": "^4.23.0"
  }
}
const { Builder } = require('selenium-webdriver');
const { expect } = require('chai');

describe('Mobile web smoke (Appium + Android Chrome)', function () {
  this.timeout(90_000);

  let driver;

  before(async () => {
    driver = await new Builder()
      .usingServer('http://127.0.0.1:4723')
      .withCapabilities({
        platformName: 'Android',
        browserName: 'Chrome',
        'appium:automationName': 'UiAutomator2',
        'appium:deviceName': 'Android Emulator',
        'appium:chromedriverAutodownload': true
      })
      .build();
  });

  after(async () => {
    if (driver) await driver.quit();
  });

  it('opens example.org and checks title', async () => {
    await driver.get('https://example.org/');
    const title = await driver.getTitle();
    expect(title).to.contain('Example Domain');
  });
});