Coder Social home page Coder Social logo

androidapptest's Introduction

AndroidAppTest

  • Appium自动化测试框架,Appium 是基于UIAutomator的测试框架,官方网站:http://appium.io/
  1. 安装appium-desktop,目前最新版本为1.2.7
  2. 安装appium-python-client,目前版本为0.2.6,解压后cmd跳转解压目录输入:python setup.py install进行安装
  3. 安装android studio&sdk,可以安装android studio,也可以sdk tools,并且设置系统环境变量
  4. 安装java sdk,设置好java环境变量
  5. 安装appium-uiautomator的驱动: npm install appium-uiautomator2-driver,而安装npm需要安装nodejs
  • MonkeyRunner ,Android sdk tools 自动的工具,同样支持黑盒测试

  • Input 工具,Input工具是android系统内自带的一个jar文件,位于/system/framwork/input.jar 在cmd当中输入adb shell input 可以模拟点击,滑动,按键各种事件,Input工具本身是用java编写的,位于Android framework层 input工具的缺点就是默认不能模拟出按压的Prs值和Size值,因为默认都是1.0,需要重新编译打包input.jar文件,修改其默认参数 修改injectMotionEvent方法中的形参pressure和局部变量DEFAULT_SIZE,这两个参数分别对应Prs和Size值

    GitHub Logo

Usage: input [<source>] <command> [<arg>...]

The sources are:
      keyboard
      mouse
      joystick
      touchnavigation
      touchpad
      trackball
      dpad
      stylus
      gamepad
      touchscreen

The commands and default sources are:
      text <string> (Default: touchscreen)
      keyevent [--longpress] <key code number or name> ... (Default: keyboard)
      tap <x> <y> (Default: touchscreen)
      swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
      press (Default: trackball)
      roll <dx> <dy> (Default: trackball)
  • 用法如下:
  1. adb shell input text "nihao" 目前只支持ASCII
  2. adb shell input swipe 300 200 500 900 200 # 头2两个参数表示第一个点,即起点的坐标,三,四参数表示第二个点的坐标,即终点,最后一个参数表示按压时间为200ms
  3. adb shell input tap 300 400 表示点击 坐标为(300,400)的点
  4. adb shell input keyevent 3 表示回退到主屏幕 3这个值对应的按键就是HOME键,KeyEvent映射表

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.