Robotium API 翻译(三)——判断测试结果的方法assert、is、search
来源:互联网 发布:精通安卓网络开发 编辑:程序博客网 时间:2024/05/28 15:56
下面的这些方法都主要用来判断测试结果是否与预期结果相符,一般把is和search方法放在assert里面判断。assert最常用的还是assertThat方法,是Junit的判断,这里就不多说了。断言方法assert(robotium特有的断言方式,实际项目中和Junit的assert方法配合使用)void assertCurrentActivity (String message, Class activityClass [,boolean isNewInstance])断言当前的activity是否是预期的参数:message-如果运行失败打印的消息activityClass-预期的activityisNewInstance-可选项,实际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-如果没有找到该文本
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search .
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- Robotium 判断测试结果的方法assert、is、search
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- Robotium API 翻译(五)——web控件测试方法,WebElement和By类
- HDU --- 2015 偶数求和
- [ZT]DDR2与DDR的区别
- AutoCAD中不能打印图形解决一例
- XP提示hal.dll文件找不到,无法启动
- [转贴]萧功秦:为什么我们缺少特立独行的人生态度
- Robotium API 翻译(三)——判断测试结果的方法assert、is、search
- 禁用win2000的MMC
- Android高效加载大量图片
- [ZT]POSTFIX郵件伺服器設定(一)
- [ZT]分享一下我老板身上偷学来的东西
- 正则表达式学习笔记(一)
- 两条经验
- [android] Serializable 和 Parcelable 区别
- GHOST四则(大于1G文件作镜像)