Sitemap

🧪 How to Set Up Mobile App Testing with Appium & WebdriverIO — 2025 version

4 min readJul 20, 2025

Mobile app testing often feels like a puzzle with missing pieces, especially when you’re trying to set up a reliable automation environment. If you’ve ever found yourself wrestling with configurations, dependencies, and cryptic errors just to get a basic test running, you’re not alone. The good news? It doesn’t have to be that hard.

This guide is your shortcut to mastering mobile app testing for Android using two powerful tools: Appium and WebdriverIO. We’ll cut through the confusion and provide you with clear, step-by-step instructions, transforming your local machine into a robust testing hub. Whether you’re a seasoned QA engineer or just starting your automation journey, you’ll find everything you need here to go from zero to automated tests, all explained with a focus on simplicity and efficiency.

Ready to demystify mobile testing and level up your skills? Let’s dive in!

🧰 Prerequisites

  • Node.js installed (brew install node) or install it from the official site
  • Basic terminal knowledge

🏗️ Step 1: Install Android Studio + Set Up the SDK

Press enter or click to view image in full size

Download and Install Android Studio from developer.android.com/studio. Then update your shell profile:

echo 'export ANDROID_HOME=~/Library/Android/sdk' >> ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin' >> ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/platform-tools' >> ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/emulator' >> ~/.zshrc
source ~/.zshrc

✅ Confirm installation:

which emulator
which adb

☕ Step 2: Install Java (OpenJDK 17)

Appium needs Java to run Android commands:

brew install openjdk@17
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
export CPPFLAGS="-I/opt/homebrew/opt/openjdk@17/include"
source ~/.zshrc

🤖 Step 3: Install Appium

You can install Appium globally:

npm install --global appium
appium driver install uiautomator2

Or use the official installer (more guided):

npx appium-installer

🔍 Step 4: Use Appium Inspector

Press enter or click to view image in full size

Appium Inspector helps you find selectors and interact with the app UI.

  • Start the Appium server:
appium -p 4723
{   
"platformName": "Android",
"appium:automationName": "UiAutomator2",
"appium:platformVersion": "11",
"appium:uuid": "emulator-5554",
"appium:app": "/path/to/monefy.apk",
"appium:appActivity": "com.monefy.app.lite/com.monefy.activities.main.MainActivity_",
"appium:appWaitActivity": "*"
}
  • Add localhost as the address and 4723 as the port.
  • Hit Start Session, and you can now inspect elements visually! 🔍

Hint:

You have to run TWO Appium servers. One to handle the Appium Inspector calls and the other one to handle your testing requests.

📲 Step 5: Start an Android Emulator

Via Android Studio UI (Device Manager), or from the terminal:

emulator -list-avds
emulator -avd your-emulator-name
adb devices # to list the running devices

To inspect details:

# Get device name
adb -s <device-id> shell getprop ro.product.model
# Android version
adb -s <device-id> shell getprop ro.build.version.release
# App focus/activity
adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'
# App ID (package)
adb -s <device-id> shell pm list packages | grep your-app

🧪 Step 6: Define Desired Capabilities

Here’s what a sample desiredCapabilities object looks like:

{
"platformName": "Android",
"appium:automationName": "UiAutomator2",
"appium:platformVersion": "16",
"appium:deviceName": "sdk_gphone64_arm64",
"appium:app": "/your/path/to/monefy.apk"
}

📍 Use these values to tell Appium how to talk to the emulator.

⚙️ Step 7: Set Up WebdriverIO

Create your WDIO test project:

npm init wdio@latest .

Pick:

  • Mocha or Jasmine
  • Appium as a service
  • Allure Reporter

Install some extras:

npm install @wdio/allure-reporter prettier appium @wdio/appium-service --save-dev

🛠 Step 8: Configure wdio.conf.js

Make sure that there is a running Appium server at port 4724.

Update your wdio.conf.js like this:

port: 4724,
services: ['appium'],
capabilities: [{
platformName: 'Android',
'appium:automationName': 'UiAutomator2',
'appium:platformVersion': '16',
'appium:deviceName': 'sdk_gphone64_arm64',
'appium:app': '/path/to/monefy.apk',
'appium:ensureWebviewsHavePages': true,
'appium:nativeWebScreenshot': true,
'appium:newCommandTimeout': 3600,
'appium:connectHardwareKeyboard': true,
}],

Here is a full example of the `wdio.conf.ts`:

export const config: WebdriverIO.Config = {
services: [
['appium', {
args: {
port: Number(APPIUM_PORT),
}
}]
],
runner: 'local',
tsConfigPath: './tsconfig.json',
specs: ['./test/specs/**/*.ts'],
exclude: [],
maxInstances: 1,
capabilities: [
{
platformName: PLATFORM_NAME,
'appium:platformVersion': PLATFORM_VERSION,
'appium:deviceName': DEVICE_NAME,
'appium:app': APP_PATH,
'appium:automationName': 'UiAutomator2',
'appium:ensureWebviewsHavePages': true,
'appium:nativeWebScreenshot': true,
'appium:newCommandTimeout': 3600,
'appium:connectHardwareKeyboard': true,
'appium:appWaitActivity': '*'
}
],
logLevel: 'info',
bail: 0,
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000
},
reporters: [
'spec',
[
'allure',
{
outputDir: './allure-results',
disableWebdriverStepsReporting: false,
disableWebdriverScreenshotsReporting: false
}
]
],

};

✅ You Did It!

Congrats! 🎉

You now have a complete mobile automation setup using:

  • Android Studio 📱
  • Appium 🤖
  • WebdriverIO 🧪
  • Appium Inspector 👀

You can now write tests, inspect elements, and run everything locally like a testing boss 😎

🙋 Need more?

Feel free to leave a comment, suggest improvements, or share your own setup tips. Sharing helps the community grow ❤️

#MobileTesting #Appium #WebdriverIO #QA #Testing #AndroidDev #Automation #DevTools

--

--

No responses yet