Giter Club home page Giter Club logo

pytest_allure_airtest_demo's Introduction

Sample for Automated UI Test of Apps.

使用以下优秀工具:

  • pipenv
  • pytest
  • allure
  • airtest
  • jenkins

使用Jenkins插件:

  • git
  • Extended Choice Parameter
  • Allure

iOS 所需工具:

  • Apple Configurator 2(可从App Store安装) 命令行工具 cfgutil

说明:

  • run.sh 工作流程
  • 使用 pipenv 管理虚拟环境,--skip-lock 应对 pipenv lock问题
  • 在 config.py 中获取 Jenkins Job 参数,写入配置文件,安装APP,参数写入 allure environment 文件用以展示
  • 使用 pytest 来组织管理和运行用例
  • 使用 airtest 来操作APP页面
  • 使用 allure 来记录信息和生成报告
  • 采用 PageObject 组织页面,以复用代码和后期维护
  • 使用魔法方法 __ getattribute __ 实现简化控件获取使用和动态获取页面对象
    • 控件只需以字典方式定义,便可自动获取并实例化
    • 页面只需创建,便可自动获取并实例化
  • 使用 命令行工具 cfgutil 来管理 iOS APP
  • 屏幕截图存放在 data/report.xlsx 中

运行配置:

  • phones 可定义多个,则会在每个设备上轮流运行用例
  • iOS 要按照airtest的说明配置iOS-Tagent,和iproxy

注意:

  • data 目录下存放着一个Android 示例应用
  • 需测试 iOS 的话,应该在 Mac 机上部署,比如在 Macmini 上。
  • 示例中没有使用git仓库,可自行配置
  • 本地运行单个用例建议使用 pycharm,添加 pytest 并设置参数运行 pycharm配置测试示例 Pycharm pytest 运行结果图
  • Jenkins示例参数化配置

Jenkins中查看Allure Report:

截图表格

建议:

  • 深入学习编程技术
  • 深入学习 自动化测试技术
  • 深入学习 Pytest, Allure, Airtest 等框架

Todo:

  • 丰富功能
    • 异常捕获并截屏
    • wait exists, click
    • 绑定 wait exists, click
    • 截图到Excel中
    • 重试连接设备
    • 绑定可重试图像操作
  • 重构
    • 动态获取页面

pytest_allure_airtest_demo's People

Contributors

standoutstar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.