App、Web自动化测试平台实战(一)

课后评价表单:20200707-若桐-Appweb自动化测试平台实战(一)-课后调查问卷

官网:https://developer.android.com/studio/test/monkey

基本操作

  • 基本配置:设置操作数量
  • 操作限制:只测指定的包
  • 事件类型和出现频率
  • 调试选项
adb shell monkey -p com.xueqiu.android -v 500
adb shell monkey -p com.xueqiu.android -vv 500
adb shell monkey -p com.xueqiu.android -v --throttle 300 30
adb shell monkey -p com.xueqiu.android -v -s 200  500

事件操作

adb shell monkey -p com.xueqiu.android -v --pct-nav 70 --pct-touch 30  500

–pct-touch :点击事件(按下弹起)
–pct-motion 移动事件(按下,移动,弹起)
–pct-trackball 轨迹球事件(随机移动+概率点击)
–pct-nav 导航事件(点击设备的上、下、左、右按键)
–pct-majornav :点击主要导航按键的操作(如键盘的中间键、回退按键、菜单按键)
–pct-syskeys :点击系统保留使用的按键的操作(如点击Home键、返回键、音量调节键等)
–pct-appswitch :启动Activity的操作(执行startActivity()方法)
–pct-anyevent :不常用的设备上的按钮

多设备 monkey 并行

#!/bin/bash
devices=`adb devices | grep - | awk '{print $1}'`
for device in $devices; do
 { nohup adb -s $device shell monkey -p com.xueqiu.android --pct-touch 30 --pct-nav 40 -v --throttle 100 300 & }
done

maxim

https://github.com/zhangzhao4444/Maxim

adb shell CLASSPATH=/sdcard/monkey.jar:/sdcard/framework.jar exec app_process /system/bin tv.panda.test.monkey.Monkey -p com.xueqiu.android --uiautomatormix --running-minutes 60 -v -v

appcrawler

https://github.com/seveniruby/AppCrawler

点击我的,进行滑动,点击设置
在设置页面完成自动化遍历

capability:

  noReset: "true"

  fullReset: "false"

  appium: "http://127.0.0.1:4723/wd/hub"

  appPackage: "com.xueqiu.android"

  appActivity: ".view.WelcomeActivityAlias"

  udid: "emulator-5556"

testcase:

  name: "TesterHome AppCrawler"

  steps:

    - xpath: 我的

      action: click

    - xpath: //*

      action: driver.swipe(0.5, 0.9, 0.5, 0.1)

    - xpath: 设置

      action: click

弹窗解决

点击按钮,触发triggerActions关闭登录页面

testcase:
  name: "TesterHome AppCrawler"
  steps:
    - xpath: "//*[@resource-id='com.xueqiu.android:id/post_status']"
      action: click
triggerActions:
    - xpath: "//*[@resource-id='com.xueqiu.android:id/iv_close']"
      action: click

作业

点击搜索按钮,输入alibaba,点击阿里巴巴-SW
选取股票,先后遍历如图两个部分

image

张涛作业:


image

郑向红作业:

testcase:
  name: "TesterHome AppCrawler"
  steps:
  - xpath: "//*[contains(@resource-id,'com.xueqiu.android:id/tv_search')]"
    action: click
  - xpath: "//*[contains(@resource-id,'com.xueqiu.android:id/search_input_text')]"
    action: "alibaba"
  - xpath: "阿里巴巴-SW"
    action: click 
  - xpath: "//*[contains(@resource-id,'com.xueqiu.android:id/stock_layout')]"
    action: click
selectedList:
  - xpath: "//*[@resource-id='com.xueqiu.android:id/small_period_container']//android.widget.TextView"
  - xpath: "//*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView"
firstList:
  - xpath: "//*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView"
tagLimitMax: 6

AppCrawler作业:罗海龙

AppCrawler_张志格-作业

testcase:
name: “TesterHome AppCrawler”
steps:
- xpath: “//[@resource-id=‘com.xueqiu.android:id/home_search’]"
action: click
- xpath: "//
[@resource-id=‘com.xueqiu.android:id/search_input_text’]”
action: “alibaba”
- xpath: “//[@text=‘阿里巴巴-SW’]"
action: click
- xpath: "//
[@resource-id=‘com.xueqiu.android:id/stockName’]”
action: click
selectedList:

  • xpath: “//[contains(@resource-id,‘quote_plate’)]//[@clickable=‘true’]”
  • xpath: “//[contains(@resource-id,‘small_chart_stock_info_container’)]//[@clickable=‘true’]”
  • xpath: “//[contains(@resource-id,‘ll_quote_header’)]//[@clickable=‘true’]”
    firstList:
  • xpath: “//[contains(@resource-id,‘quote_plate’)]//[@clickable=‘true’]”

appcrawler作业:林遵明

capability:
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
  appPackage: "com.xueqiu.android"
  appActivity: ".view.WelcomeActivityAlias"
testcase:
  name: "TesterHome AppCrawler"
  steps:
  - xpath: "//*[contains(@resource-id,'tv_search')]"
    action: click
  - xpath: "//*[contains(@resource-id,'search_input_text')]"
    action: "alibaba"
  - xpath: 阿里巴巴-SW
    action: click
  - xpath: "//*[contains(@resource-id,'stock_layout')]"
    action: click
selectedList:
  - xpath: "//*[@resource-id='com.xueqiu.android:id/small_period_container']//android.widget.TextView"
  - xpath: "//*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView"
firstList:
  - xpath: "//*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView"
lastList:
  - xpath: "//*[@resource-id='com.xueqiu.android:id/small_period_container']//android.widget.TextView"

陈智斌【app web自动化测试平台实战一】作业提交

贾潇冰-APP、Web自动化测试平台实战(一)作业