Skip to content
Back to skills

Android App Testing

ASecurity

Test Android applications using Appium with Espresso driver for fast, reliable automation. **Key Advantage:** Espresso driver is 2x faster than UI Automator 2 with automatic UI synchronization -- no manual waits needed.

  • 31 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
ai-agentspythontestinggitdocumentation

Works with

  • cli

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned June 6, 2026

npx -y skills add frank-luongt/faos-skills-marketplace --skill android-app-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android App Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android App Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/frank-luongt-android-app-testing/badge)](https://www.skillsdirectory.com/skills/frank-luongt-android-app-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->
---
name: android-app-testing
description: Automated testing for Android applications using Appium with Espresso driver. Use when testing native Android apps (.apk files), verifying mobile UI functionality, automating gestures (swipe, scroll, tap), or running blackbox tests on Android devices/emulators. Covers Espresso (fast, source-required) and UI Automator 2 (black-box) approaches.
tags: [android, mobile-testing, appium, espresso, ui-automator]
---

# Android App Testing

Test Android applications using Appium with Espresso driver for fast, reliable automation.

**Key Advantage:** Espresso driver is 2x faster than UI Automator 2 with automatic UI synchronization -- no manual waits needed.

## When to Use

- Testing native Android apps (.apk files)
- Verifying mobile UI functionality
- Automating gestures (swipe, scroll, tap)
- Running blackbox tests on Android devices/emulators
- QA agent workflows in multi-agent teams

## Decision Tree

```
Do you have app source code?
    Yes -> Use Espresso driver (FAST, automatic waits)
    No  -> Use UI Automator 2 driver (black-box testing)
```

Use Espresso whenever possible (requires app source code but 2x faster).

## Prerequisites

- Appium 3.x installed
- Espresso driver: `appium driver install espresso`
- Python client: `pip install Appium-Python-Client`
- Device/emulator connected: `adb devices`

## Quick Start

```python
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy

# Configure for Espresso (fast)
options = UiAutomator2Options()
options.platform_name = "Android"
options.automation_name = "Espresso"  # Use Espresso for speed
options.app = "/path/to/app.apk"
options.device_name = "Android Emulator"
options.auto_grant_permissions = True

# Start session
driver = webdriver.Remote("http://localhost:4723", options=options)

# Espresso automatically waits - just find and interact
driver.find_element(by=AppiumBy.ID, value="username").send_keys("testuser")
driver.find_element(by=AppiumBy.ID, value="login_button").click()

# Verify result
assert driver.find_element(by=AppiumBy.ID, value="home_screen").is_displayed()

driver.quit()
```

## Element Locator Strategy

| Strategy | Speed | Example |
|---|---|---|
| ID | Fastest | `AppiumBy.ID, "button_login"` |
| Accessibility ID | Fast | `AppiumBy.ACCESSIBILITY_ID, "login"` |
| Class Name | Medium | `AppiumBy.CLASS_NAME, "android.widget.Button"` |
| XPath | Slowest | Avoid unless necessary |

## Gesture Automation (Appium 2.0+)

```python
# Tap at coordinates
driver.execute_script('mobile: clickGesture', {'x': 100, 'y': 200})

# Swipe
driver.execute_script('mobile: swipeGesture', {
    'left': 100, 'top': 500, 'width': 200, 'height': 200,
    'direction': 'up', 'percent': 0.75
})

# Long press
driver.execute_script('mobile: longClickGesture', {
    'elementId': element.id, 'duration': 2000
})
```

## Reconnaissance Pattern (Unknown Apps)

1. Launch and wait for app to load
2. Take screenshot: `driver.save_screenshot('/tmp/screen.png')`
3. Discover elements:
   ```python
   buttons = driver.find_elements(by=AppiumBy.CLASS_NAME, value="android.widget.Button")
   for btn in buttons:
       print(f"Button: {btn.text} (ID: {btn.get_attribute('resource-id')})")
   ```
4. Use discovered IDs in tests

## Anti-Patterns

| Avoid | Why | Instead |
|---|---|---|
| XPath locators | Very slow | Use ID or Accessibility ID |
| TouchAction class | Removed in Appium 2.0+ | Use `mobile:` gesture scripts |
| `time.sleep()` with Espresso | Espresso has automatic waits | Let Espresso handle synchronization |
| Missing `finally` block | Leaves sessions open | Always `driver.quit()` in finally |
| Testing before Appium server starts | Tests fail immediately | Start Appium server first: `appium` |

## References

- Source: claude-skills/android-app-testing (MIT License)
- [Appium Documentation](https://appium.io/)
- [Espresso Driver](https://github.com/nickolanack/appium-espresso-driver)

<!-- Source: .faos/custom/skills/testing/android-app-testing/SKILL.md -->

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…