Giter VIP home page Giter VIP logo

yamlappium's Introduction

Pytest 运行 Yaml 来驱动 Appium 进行 UI 测试

Yaml 使用方式规则

test_index:
  -
    method: launchApp # 启动 APP
  -
    method: 方法名称 例如:click (必填)
    element: 查找元素id,class等 (选填,配合 method 如需要点击元素,查找元素等必填)
    type: 元素类型 id,xpath,class  name,accessibility id (选填,会自动识别,如识别错误则自行填写)
    name: 测试步骤的名称 例如:点击搜索按钮 (选填)
    text: 需要输入或者查找的文本 (选填,配合部分 method 使用)
    time: 查找该元素需要的时间,默认 5s (选填)
    index: 页面有多个id,class时,不为空则查找元素数组下标 (选填)
    is_displayed: 默认 True ,当为 False 时元素未找到也不会抛异常(选填)
 需要参数的 method
 |  click(self, locator)
 |      基础的点击事件
 |  is_element_displayed(self, locator)
 |      控件是否显示e
 |  get_text(self, locator)
 |      获取元素文本
 |  screenshot_element(self, locator)
 |      区域截图
 |  set_text(self, locator)
 |      输入文本
 
 不需要参数的 method
 |  launchApp(self)
 |      重启应用程序
 |  photograph(self)
 |      拍照
 |  set_keycode_enter(self)
 |      回车键
 |  set_keycode_search(self)
 |      搜索键 
 |  swip_down(self)
 |      向下滑动,常用于下拉刷新
 |  swip_left(self)
 |      向左滑动
 |  swip_right(self)
 |      向右滑动
 |  swip_up(self)
 |      向上刷新
 |  click_shoot_windows(self)
 |      检测权限窗口 

运行方式

pytest -s ./test_case/test_ranking.yml --alluredir './report/test'

或者直接运行文件目录

使用方法和基本 pytest 用法没有太大区别

pytest -s ./test_case --alluredir './report/test'

yamlappium's People

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.