zoukankan      html  css  js  c++  java
  • RobotFrameWork+APPIUM实现对安卓APK的自动化测试----第五篇【AppiumLibrary校验函数介绍】

    http://blog.csdn.net/deadgrape/article/details/50619050

    以上连作者先跪一下方便面,在上一篇中,作者遗漏了两个常用的函数:

    1.长按

    Long Press locator

    Long press the element

    这个函数的作用为:长按一个控件

    2.缩小(翻译为 “捏”)

    Pinch locator, percent=200%, steps=1

    Pinch in on an element a certain amount.

    这个函数作者老实坦白,没有试验过,个人赶脚和ZOOM是一样的(放大),缩小功能

    好啦接下来开始我们的第五篇啦,校验函数的介绍。

    校验主要是用来判断界面操作是否成功,主要方法有:判断URL是否正确、需要的元素是否出现、需要元素属性是否正确、等等

    1.元素校验

    Element Name Should Be locator, expected  
    Element Should Be Disabled locator, loglevel=INFO

    Verifies that element identified with locator is disabled.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Element Should Be Enabled locator, loglevel=INFO

    Verifies that element identified with locator is enabled.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Element Value Should Be locator, expected

    这一组为元素级别的校验,是较为细致的校验,

    第一个是检查元素的NAME属性,

    第二个为检查元素是否为不可用/见,

    第三个为检查元素是否可用/见,

    第四个为检查元素value属性;

    这一组作者自己用的较少,个人认为现在做APP自动化测试,界面内容本来就不多,无需这么精细。

    备注:locator为元素定位,loglevel为日志等级,expected为希望值,同学们照着填就可以了。

    2.界面校验

    Page Should Contain Element locator, loglevel=INFO

    Verifies that current page contains locator element.

    If this keyword fails, it automatically logs the page source using the log level specified with the optionalloglevel argument. Givin

    Page Should Contain Text text, loglevel=INFO

    Verifies that current page contains text.

    If this keyword fails, it automatically logs the page source using the log level specified with the optionalloglevel argument. Giving NONE as level disables logging.

    Page Should Not Contain Element locator, loglevel=INFO

    Verifies that current page not contains locator element.

    If this keyword fails, it automatically logs the page source using the log level specified with the optionalloglevel argument. Givin

    Page Should Not Contain Text text, loglevel=INFO

    Verifies that current page not contains text.

    If this keyword fails, it automatically logs the page source using the log level specified with the optionalloglevel argument. Giving NONE as level disables logging.

    这一组为界面级别的校验,是一个较为常用的校验,

    第一个为界面必须包含什么元素,

    第二个为界面必须包含什么文字信息,(最为常用)

    第三个为界面必须不包含什么元素,

    第四个为界面必须不包含什么文字信息,(第二个最为常用)

    作者写断言的时候,大部分都用的是第二个和第四个,当然这个是作者自己的偏好,同学们还是应该更为宽广的应用函数。

    第五篇的内容就这些了,希望对童鞋们的APPIUM自动化测试指路能有所帮助。如果有什么遗漏的或者说的不对的也请同

  • 相关阅读:
    [转] linux 信号量之SIGNAL
    [转] 查看CPU使用率 top命令详解
    shell 脚本编程
    ToggleButton
    MultiAutoCompleteTextView
    AutoCompleteTextView
    IO流总结
    JavaWeb 案例——访问权限控制
    IO流之字符流
    File类
  • 原文地址:https://www.cnblogs.com/yunman/p/6656358.html
Copyright © 2011-2022 走看看