Android-UI自动化测试环境配置

发布于:2025-02-10 ⋅ 阅读:(46) ⋅ 点赞:(0)

Android-UI自动化测试

Appium-Android-Python-Mac开发环境

一、Android自动化测试环境准备

1.安装appium 客户端
  1. http://appium.io/docs/en/about-appium/getting-started/?lang=zh#setting-up-the-appium-client
  2. 验证客户端安装 :

​ appium-doctor

2.安装Android SDK
  1. echo $ANDROID_HOME

​ /Users/huangchang/Library/Android/sdk

3.安装selenium
  1. https://pypi.python.org/simple/selenium/ 下载包
  2. cd selenium-3.0.0 切换到selenium文件夹
  3. sudo python setup.py install 使用该命令安装
4.安装appium-python-client
  1. https://pypi.org/project/Appium-Python-Client/#files 下载包。
  2. cd Appium-Python-Client-0.26 切换到Appium-Python-Client-0.26文件夹
  3. sudo python setup.py install 使用该命令安装
5.安装Pythoncharm
  1. https://www.jetbrains.com/pycharm/
6.调起UIAutomatorviewer
  1. echo $ANDROID_HOME通过该命令查找Android-SDK路径;切换到UIAutomatorviewer文件的目录下。 如若未找到,使用 find . -name uiautomatorviewer 命令找所在目录
  2. 通过./uiautomatorviewer 命令调起UIAutomatorviewer
  3. 注:UIAutomatorviewer 可以获取Android手机上的界面元素 (resource-id最常用)
7.运行Demo脚本的步骤:
  1. 确保环境已经搭建完毕,否则请前往 http://mts.daily.aliyun.net/doc.htm,按照”帮助文档“ -> “Appium文档” -> "环境搭建"中的文档进行环境搭建。
  2. 启动Appium Server. 在命令行中执行:appium -p 4723
  3. 修改desired_capabilities.py
    a. 修改desired_caps中的’app’对应的值,改为指向解压后的此目录内MqcDemoApp.apk的绝对路径
    b. 修改desired_caps中的’automationName’对应的值。如果PC连接终端系统版本>=4.2,改为"Appium";否则无需修改,使用"Selendroid"
  4. 在另外一个终端中,执行命令:python -m unittest main (温馨提示,先切换到该project的目录下再执行该命令)
  5. 观察手机上进行的自动化测试就可以了。
  6. https://help.aliyun.com/document_detail/50708.html 参考链接

二、Appium服务器参数

http://appium.io/docs/cn/writing-running-appium/server-args/index.html

三、Appium API Documentation

https://appium.io/docs/en/about-appium/api/


网站公告

今日签到

点亮在社区的每一天
去签到