Skip to main content

UTX will help you write application automated tests more easily!

Project description

UTX

安装

  • 命令行执行
pip install -U utx

设计理念

很大程度上借鉴了HttpRunner(优秀的框架)。不同的是,utx更着重写python,而不是写YAML文件。

  • 简单是更好的
  • 每个人都能用python写自动化

这就是utx的设计理念。

项目结构

  • utx提供了快速创建项目的能力,也就是脚手架。
utx startproject project_name
$ utx startproject demo
2021-09-01 12:39:16.491 | INFO     | utx.cli.scaffold:create_scaffold:51 - Create new project: demo
Project root dir: /PycharmProjects/demo

Created folder: demo
Created folder: demo/config
Created folder: demo/logs
Created folder: demo/packages
Created folder: demo/report/airtest
Created folder: demo/tests
Created folder: demo/suites
Created file: demo/.gitignore
Created file: demo/conftest.py
Created file: demo/pytest.ini
Created file: demo/run.py
Created file: demo/requirements.txt
Created file: demo/config/conf.py
Created file: demo/config/config.ini
Created file: demo/config/__init__.py
Created file: demo/tests/test_devices.py
Created file: demo/tests/__init__.py
Created file: demo/report/summary_template.html

调用流程图

专注于写脚本

  • 项目结构很清晰。在conftest.py进行一些初始化/参数化/清理工作,在suites/写测试脚本。

在AirtestIDE中写好.air脚本,然后将文件放到suites文件中。

  • 更注重平铺写脚本的方式,这样就离“每个人都能用python写自动化”更近一步。毕竟封装之后看着容易晕,我也晕。
  • 去除掉框架的约束,给每个人写python的自由,在测试脚本里你可以尽情发挥你的代码风格,代码能力,千人千面。代价呢,就是代码质量参差不齐。

大胆写,能写,写出来,跑通,就已经是在写自动化,就已经是在创造价值了!

轻封装

utx尊重原生用法。

airtest的封装只通过装饰器进行了运行方式的调整,没有做任何其他的冗余修改。

  • faker,造数据工具
  • pytest,测试框架
  • airtest,自动化测试工具
  • pandas、numpy,数据处理工具

安装utx,自动就把这些开源利器安装上了,无需单独安装。未来会集成更多实用工具到utx中。

utx本身是很轻的。

功能介绍

  1. 支持android,ios 平台的自动化测试框架
  2. 脚本批量执行
  3. 每个脚本执行日志分开存放
  4. 每个脚本单独生成一个html报告并在父文件夹生成一个聚合报告
  5. 自定义的聚合报告,详细展示运行结果
  6. 重试机制,运行失败自动重跑,可自定义重跑次数
  7. 自定义脚本运行,可选择部分模块单独运行
  8. 自带脚手架工具可以快速生成框架目录

使用说明

  • 只需在配置文件中填好相关内容,即可运行!
[device_info]
;设备远程链接URL 设备ip+端口或者设备唯一标识id
device = 127.0.0.1:5555
;设备平台iOS或者Android
platform = android
;ios设备驱动包名,仅测试iOS时需要
wda = com.facebook.WebDriverAgentRunner.utx.xctrunner
;是否执行安装卸载操作 True/False
init = True

[app_info]
;app包名
package = com.wx.mp.test
;apk或者ipa文件名
filename = app_test.apk

[reruns]
;失败后再次运行次数,默认1次
times = 1

[mode]
;0表示 运行[suites][cases]选择的用例  1表示运行全部用例
is_all = 0

[suites]
;填写用例的关键字
cases = test.air
  • 启动命令
  1. 普通启动
python run.py
  1. 参数化启动
# Android
python run.py --platform=Android --device=127.0.0.1:5555 --init=True
# iOS
python run.py --platform=iOS --wda=com.facebook.WebDriverAgentRunner.utx.xctrunner --init=True

参数优先级大于配置文件

运行结果

  • 报告展示

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utx-1.0.0.tar.gz (5.7 MB view details)

Uploaded Source

Built Distribution

utx-1.0.0-py3-none-any.whl (5.7 MB view details)

Uploaded Python 3

File details

Details for the file utx-1.0.0.tar.gz.

File metadata

  • Download URL: utx-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.4

File hashes

Hashes for utx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 791df543dbd363aa097df4bcadad94c392b1263c3534d3b1a8b87127adb1887a
MD5 3e4b97ce7f52af9c6f5bd1a3b812aa32
BLAKE2b-256 cbc5a841e1c9acf6ff2c012264e2ee3500cd9248cbc79aadd63233bb1a4cf933

See more details on using hashes here.

Provenance

File details

Details for the file utx-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: utx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.4

File hashes

Hashes for utx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 557e7fab3b4180f4df7b556ae055b8566bdd36bdd664f43407470cb82aa2f59c
MD5 2c587d1ea67ee10a2bbbbcbcbb17ca73
BLAKE2b-256 cbeff39eaba7a8d4aa9d82b815757d10c20ba3b174359952fd0aed53e674ae30

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page