zoukankan      html  css  js  c++  java
  • DroidPilot 测试脚本详解(二)

    8.        支持 contains in 比较符号,书写格式如下:

    a contains b (当a包含了b时,返回true, 否则false)

    a in b  (当b包含了a时,返回true, 否则false)

    Script Example:

    a.(contains):

    database(dbPath="mnt/sdcard/AppFiles/com.ebensz.cardname/card.db",pkgName="com.ebensz.cardname",dbName="card.db",sql="Select name as countname From cards Where head like '%杨%' or spell like '%Y%'",args="",return="countname")

    If "[countname]" contains "杨杰" Then

      Reporter.ReportEvent micPass,"SearchRecords","Search correctly"

    Else

      Reporter.ReportEvent micFail,"SearchRecords", "Search Incorrectly"

    End If

    b.(in):

    database(dbPath="mnt/sdcard/AppFiles/com.ebensz.cardname/card.db",pkgName="com.ebensz.cardname",dbName="card.db",sql="Select name as countname From cards Where head like '%杨%' or spell like '%Y%'",args="",return="countname")

    If  "杨杰" in "[countname]"  Then

      Reporter.ReportEvent micPass,"SearchRecords","Search correctly"

    Else

      Reporter.ReportEvent micFail,"SearchRecords", "Search Incorrectly"

    End If

    9.        支持=, ==, >=, >, <=, < 比较符号,跟数值进行比较,格式如下:

    a = b

    a == b

    a >= 12

    a > 12

    a <= 12

    a < 12

    Script Example:

    database(dbPath="mnt/sdcard/AppFiles/com.ebensz.cardname/card.db",pkgName="com.ebensz.cardname",dbName="card.db",sql="Select count(*) as countname From cards ",args="",return="countname")

    If "[countname]" == 12 Then

      Reporter.ReportEvent micPass,"SearchRecords","Search  correctly"

    Else

      Reporter.ReportEvent micFail,"SearchRecords", "Search Incorrectly"

    End If

    10.     支持and, or (或&& ||) 操作符,格式如下:

    a == b and c == d or e == f

    也可以写成

    a == b&& c == d || e == f

    如下写成a == b && (c == d || e == f)带括号的形式,则会先对c == d || e == f进行比较,再与a==b比较

    11.     支持longClick,长按某个应用出菜单

    Script Example:

    Window("HomePage").Button("android.widget.Button@2afee6d8").click

    Window("FamilyNames").ImageView("android.widget.ImageView@2b1ab7a0").longClick

    12.     支持功能按键

    KeyClick.Back_Key:返回到前一页

    KeyClick.Home_Key:返回到主页

    KeyClick.Volume_Up:声音调大

    KeyClick.Soft_Left:左软键

    KeyClick.Soft_Right:右软键

    KeyClick.Menu_Key:右键菜单

    KeyClick.Volume_Down:声音调小

    KeyClick.Media_Play_Pause:视频暂停播放

    KeyClick.Media_Stop:视频停止播放

    KeyClick.Media_Next:播放下一个视频

    KeyClick.Media_Previous:播放上一个视频

    KeyClick.Media_Rewind:视频倒放

    KeyClick.Media_Fast_Forward:视频快进播放

    13.     支持updateTime: 更新时间

    Script Example:

    Window("MainActivity-1").TimePicker("android.widget.TimePicker@41130a28").updateTime="14:55:44"

    14.     支持updateDate :更新日期

    Script Example:

    Window("MainActivity-3").DatePicker("android.widget.DatePicker@411862b0").updateDate="2012-4-26"

    15.    支持go on (部分新闻客户端,媒体报纸应用)

    在Android 4.0的应用,需要在script首行添加go on 语句

    16.     其他一些需要注意的点

    a:标准检查点不要坐标coordinate()

    b:EditText对象必须加ActionType("input")或ActionType("append")或ActionType("insert")

    c:If语句内的等于号必须左右无空格

    d:If Else End If   必须注意首字母大写,其他字母小写

    e:写脚本尽量用script的助写功能,打个点就可以从下拉列表中选取

  • 相关阅读:
    Vuejs的一些总结
    vue.js中$emit的理解
    Vue.js——60分钟快速入门
    [ARC096E] Everything on It
    [ARC093E] Bichrome Spanning Tree
    [ARC093F] Dark Horse
    [ARC100F] Colorful Sequences
    卡特兰数 学习笔记
    【原】图练习
    【原】图
  • 原文地址:https://www.cnblogs.com/anthonywsy/p/DroidPilot-Quickstart-Script2.html
Copyright © 2011-2022 走看看