uiautomator2+python UI自动化测试框架(一)

一。环境搭建

1.安装node.js。Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。在官网上下载对应的版本安装:https://nodejs.org/en/download/

2.安装python,首先访问http://www.python.org/download/去下载最新的python版本,并将安装目录搭到环境变量,此处安装步骤略,本人安装的是python3

3.安装uiautomator2,这里的uiautomator2不是android SDK下的uiautomator,而是一个python库,用于Android的ui自动化测试,项目地址:https://github.com/openatx/uiautomator2。使用uiautomator只能用户android端测试,不像appium为跨平台可用于ios端。使用uiautomator2可以使用wifi或数据线和手机相连。

安装方式:pip install --pre uiautomator2

4.安装pillow:图像处理标准库,安装方式:pip install pillow

5.安装pytest,pytest是python上的一个测试框架,兼容unittest的语法,因为之后的测试报告生成需要pytest的支持,所以我们要先装一下这个框架。

安装pytest:cmd界面输入命令:pip install pytest

6.安装allure2,allure 是一个轻量级的,灵活的,支持多语言,多平台的report框架。是的,它是支持多语言并在很多开源框架中做了适配集成的。我这次终于不是只介绍java的项目了。其目的就是使用简单方便的方式构建一个完善的report体系。

安装allure2需要先配置java环境(推荐java8),以及安装pytest,在cmd中:pip install pytest-allure- adaptor

猜你喜欢

转载自blog.csdn.net/zhuhuahong/article/details/81867281