zoukankan      html  css  js  c++  java
  • Robotium API -- 判断测试结果的方法assert、is、search

    下面的这些方法都主要用来判断测试结果是否与预期结果相符,一般把is和search方法放在assert里面判断。
    assert最常用的还是assertThat方法,是Junit的判断,这里就不多说了。


    断言方法assert(robotium特有的断言方式,实际项目中和Junit的assert方法配合使用)

    void assertCurrentActivity (String message, Class activityClass [,boolean isNewInstance])
    断言当前的activity是否是预期的
    参数:
    message-如果运行失败打印的消息
    activityClass-预期的activity
    isNewInstance-可选项,实际activity是否是预期activity的继承,如果为true则只要是继承关系就通过,false则必须是当前activity
    返回:无
            
    void assertCurrentActivity (String message, String name [,boolean isNewInstance])
    断言当前的activity是否是预期的
    参数:
    message-如果运行失败打印的消息
    name-预期activity的名字
    isNewInstance-可选项,实际activity是否是预期activity的继承,如果为true则只要是继承关系就通过,false则必须是当前activity
    返回:无
     
    void assertMemoryNotLow()

    断言目前系统可用内存是否过低,内存空间足够则通过

    返回:无

    is方法

    boolean isCheckBoxChecked (int index | String text)

    判断checkBox是否处于被选中的状态,可以通过index和text两种方法定位

    参数:

    index-检查的checkBox的索引值,如果只有一个可用则为0

    text-检查的checkBox的文字,可使用正则表达式

    返回:

    true-如果被选中

    false-如果没有被选中

     

    boolean isRadioButtonChecked (int index | String text)

    判断RadioButton是否处于被选中的状态,可以通过index和text两种方法定位

    参数:

    index-检查的RadioButton的索引值,如果只有一个可用则为0

    text-检查的RadioButton的文字,可使用正则表达式

    返回:

    true-如果被选中

    false-如果没有被选中

    boolean isRadioButtonChecked (int index | String text)

    判断RadioButton是否处于被选中的状态,可以通过index和text两种方法定位

    参数:

    index-检查的RadioButton的索引值,如果只有一个可用则为0

    text-检查的RadioButton的文字,可使用正则表达式

    返回:

    true-如果被选中

    false-如果没有被选中

    boolean isToggleButtonChecked (int index | String text)

    判断ToggleButton是否处于被选中的状态,可以通过index和text两种方法定位

    参数:

    index-检查的ToggleButton的索引值,如果只有一个可用则为0

    text-检查的ToggleButton的文字,可使用正则表达式

    返回:

    true-如果被选中

    false-如果没有被选中


    boolean isSpinnerTextSelected ( [int index, ]  String text)

    判断SpinnerText是否处于被选中的状态,可以通过index定位

    参数:

    index-检查的SpinnerText的索引值,如果只有一个可用则为0

    text-检查的SpinnerText的文字,可使用正则表达式

     

    返回:

    true-如果被选中

    false-如果没有被选中

    boolean isTextChecked (String text)

    判断text是否处于被选中的状态,可以通过text定位

    参数:

    text-检查的text的文字,可使用正则表达式

    返回:

    true-如果被选中

    false-如果没有被选中


    search方法

    boolean searchButton (String text [, int minimumNumberOfMatches, boolean onlyVisible])

    判断当前的屏幕中是否能找到指定的button

    参数:

    text-查找的button的文字

    minimumNumberOfMatches-最小指定多少才算是通过,0表示1个或者多个

    onlyVisible-只记录可见的

    返回:

    true-如果找到了该控件

    false-如果没有找到该控件

     

    boolean searchText (String text [, int minimumNumberOfMatches, boolean scroll, boolean onlyVisible])

    判断当前的屏幕中是否能找到指定的text,即文本

    参数:

     

    text-查找的Text的文字

    minimumNumberOfMatches-最小指定多少才算是通过,0表示1个或者多个

    scroll-是否允许滚动搜索,true表示支持,false表示只能在当前屏幕内查找

    onlyVisible-只记录可见的

    返回:

    true-如果找到了该文本

    false-如果没有找到该文本

    boolean searchToggleButton (String text [, int minimumNumberOfMatches])

    判断当前的屏幕中是否能找到指定的ToggleButton

    参数:

    text-查找的ToggleButton的文字

    minimumNumberOfMatches-最小指定多少才算是通过,0表示1个或者多个

    返回:

    true-如果找到了该控件

    false-如果没有找到该控件

    boolean searchEditText (String text)

    判断当前的屏幕中是否能找到指定的EditText

    参数:

    text-查找的Text的文字

    返回:

    true-如果找到了该文本

    false-如果没有找到该文本

    【转载:http://blog.csdn.net/tt75281920/article/details/26946695】

  • 相关阅读:
    springboot文件上传: 单个文件上传 和 多个文件上传
    Eclipse:很不错的插件-devStyle,将你的eclipse变成idea风格
    springboot项目搭建:结构和入门程序
    POJ 3169 Layout 差分约束系统
    POJ 3723 Conscription 最小生成树
    POJ 3255 Roadblocks 次短路
    UVA 11367 Full Tank? 最短路
    UVA 10269 Adventure of Super Mario 最短路
    UVA 10603 Fill 最短路
    POJ 2431 Expedition 优先队列
  • 原文地址:https://www.cnblogs.com/deepstone/p/3999526.html
Copyright © 2011-2022 走看看