跳到正文
Skillpedia
移动应用48k · #3744

android_ui_verification

它能做什么

这个工具可以帮你在 Android 手机上测试应用。它会模拟点击、输入文字并截图,检查一切是否按预期工作。

适用场景

  • ✓验证应用中的视觉改动是否生效时。
  • ✓自动发现布局或交互方面的问题时。
  • ✓无需手动测试,就能确认新功能是否正常工作时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/android_ui_verification/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/android_ui_verification/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“检查“登录”按钮是否显示,并确认我能不能点击它。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会使用特定的命令与手机“通信”。它会先找到屏幕上按钮和文字的位置,然后模拟你的点击和输入。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Android UI Verification Skill

This skill provides a systematic approach to testing React Native applications on an Android emulator using ADB commands. It allows for autonomous interaction, state verification, and visual regression checking.

When to Use

  • Verifying UI changes in React Native or Native Android apps.
  • Autonomous debugging of layout issues or interaction bugs.
  • Ensuring feature functionality when manual testing is too slow.
  • Capturing automated screenshots for PR documentation.

🛠 Prerequisites

  • Android Emulator running.
  • adb installed and in PATH.
  • Application in debug mode for logcat access.

🚀 Workflow

1. Device Calibration

Before interacting, always verify the screen resolution to ensure tap coordinates are accurate.

adb shell wm size

Note: Layouts are often scaled. Use the physical size returned as the base for coordinate calculations.

2. UI Inspection (State Discovery)

Use the uiautomator dump to find the exact bounds of UI elements (buttons, inputs).

adb shell uiautomator dump /sdcard/view.xml && adb pull /sdcard/view.xml ./artifacts/view.xml

Search the view.xml for text, content-desc, or resource-id. The bounds attribute [x1,y1][x2,y2] defines the clickable area.

3. Interaction Commands

  • Tap: adb shell input tap <x> <y> (Use the center of the element bounds).
  • Swipe: adb shell input swipe <x1> <y1> <x2> <y2> <duration_ms> (Used for scrolling).
  • Text Input: adb shell input text "<message>" (Note: Limited support for special characters).
  • Key Events: adb shell input keyevent <code_id> (e.g., 66 for Enter).

4. Verification & Reporting

Visual Verification

Capture a screenshot after interaction to confirm UI changes.

adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png ./artifacts/test_result.png

Analytical Verification

Monitor the JS console logs in real-time to detect errors or log successes.

adb logcat -d | grep "ReactNativeJS" | tail -n 20

Cleanup

Always store generated files in the artifacts/ folder to satisfy project organization rules.

💡 Best Practices

  • Wait for Animations: Always add a short sleep (e.g., 1-2s) between interaction and verification.
  • Center Taps: Calculate the arithmetic mean of [x1,y1][x2,y2] for the most reliable tap target.
  • Log Markers: Use distinct log messages in the code (e.g., ✅ Action Successful) to make grep verification easy.
  • Fail Fast: If a uiautomator dump fails or doesn't find the expected text, stop and troubleshoot rather than blind-tapping.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

使用它需要准备什么特别的东西吗?

需要。你得先在电脑上运行一个 Android 模拟器(也就是电脑上的虚拟手机),并安装好 `adb` 程序。

它是怎么知道该点哪里的?

它会对屏幕截一张“图”,分析每个按钮和文字所在的位置,再计算出准确的点击位置。

它能测试任何应用吗?

用 React Native 或原生 Android 开发的应用效果最好,而且应用需要处于调试模式,才能看到日志。

详情

作者的原始描述

Automated end-to-end UI testing and verification on an Android Emulator using ADB.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3744
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能