原文链接在这里

断言总结:

should contain 、 should not contain 与should contain x times

should contain {list_b} 1.0 should not contain{list_b} 1

should contain x times {list_b} 21 2 说明:变量{list_b}包含对象1.0而不包含对象1,且对象21在变量${list_b}出现了两次。

should be empty 与 should not be empty

should be empty {list_c} should not be empty{list_a}

说明:变量{list_c}没有赋值,所以为空;相反,变量{list_a}有赋初始值,故为非空。

should be equal 与 should not be equal

should be equal {list_a[1]}{list_b[1]}

should not be equal {list_a}{list_b}

说明:{list_a[1]}=a,{list_b[1]}=a故两个对象相等;而{list_a}和{list_b}有元素不一致,这两个对象不相等。

Should Be Equal As Numbers 与 Should not Be Equal As Numbers

Should Be Equal As Numbers {list_b[0]} 1.0000 Should not Be Equal As Numbers{list_b[0]} 1.1

说明:${list_b[0]}=1,忽略精度,故与1.0000相等;而即使是忽略精度,1与1.1还是不相等的;

Should Be Equal As Integers与Should not Be Equal As Integers

Should Be Equal As Integers {list_a[3]}{list_b[3]}

Should not Be Equal As Integers {list_a[4]}{list_b[4]}

说明:{list_a[3]}=21,{list_b[3]}=21,而系统默认为字符串格式的“21”,故需要转化为整数类型,转化为整数后两个对象相等;

{list_a[4]}=12,{list_b[4]}=21,即使转化为整数后两个对象依旧是不相等;

Should Be Equal As Strings与Should not Be Equal As Strings

Should Be Equal As Strings {list_a[2]}{list_b[2]}

Should not Be Equal As Strings {list_a[0]}{list_b[0]}

说明:{list_a[2]}={21},{list_b[2]}={21},而均为数值型的21,故需要转化为字符串类型,转化为字符串后两个对象相等;

Should Be True与Should not Be True

Should Be True {list_a[0]} < 10 Should not Be True{list_a[0]} < 1

说明:${list_a[0]}=1(字符串类型),其ASCII值比字符串10的ASCII值小;

Should start With与Should not start With

Should start With {string} peng Should not start With{string} h

说明:${string}=”pengliwen is in hangzhou“是以peng开头,而非以h开头;

Should End With与Should not End With

Should End With {string} hangzhou Should not End With{string} pengliwen

说明:${string}=”pengliwen is in hangzhou“是以hangzhou结尾,而非以pengliwen结尾;

should match与should not match

should match {name} p?? should not match{string} h?

说明:模式匹配和shell中的通配符类似,它区分大小写,''匹配0~无穷多个字符,“?”单个字符

${name}=plw,由以p开头的三个字母组成

Should Match Regexp与Should not Match Regexp

Should Match Regexp {name} ^\w{3}

Should not Match Regexp {name} ^\d{3}

说明:反斜杠在测试数据是转义字符,因此模式中要使用双重转义;'^'和''字符可以用来表示字符串的开头和结尾{name}=plw,是有三个字母--w{3}组成,而不是由三个数字--d{3}组成。

集合和列表的校验

dictionary should contain item

dictionary should contain key

dictionary should contain sub dictionary

dictionary should contain value

dictionary should not contain key

dictionary should not contain value

convert to dictionary

list should contain sub list

list should contain value

list should not contain value

convert to list

count values in list

get count

get length

数据库校验

row count is equal to x

row count is greater than x

row count is less than x

循环遍历校验

${listtest} set variable 1 a a b

:FOR {li} IN @{listtest} \ log{li}

\ run keyword if ${li}=='a' exit for loop

rf 遍历列表_RF断言总结相关推荐

  1. rf 遍历列表_RF的变量list在For循环的用法,试错中学习

    test.robot: FOR 循环要注意: 关键字:FOR  IN END必须大写,且END 需必写,中间的空格都是两个或两个以上 如果用到IN RANGE 中间的空格是1个 *** Variabl ...

  2. rf 遍历列表_RF之关键字、变量、循环

    软件测试 RF之关键字.变量.循环 关键字的使用: RF的能力是由关键字提供的,所以,我们必须对RF的常用关键字有个了解 . 其中Builtin是标准库中的内置库,Shotcuts Keywords就 ...

  3. 遍历列表python_python列表的遍历与循环

    在游戏中,可能需要将每个界面元素平移相同的距离: 对于包含数字的列表,可能需要对每个元素执行相同的统计运算: 在网站中,可能需要显示文章列表中的每个标题. 经常需要遍历列表的所有元素,对每个元素执行相 ...

  4. python3 遍历列表得到序号索引和值

    #!/usr/bin/env python # -*- coding: utf-8 -*-if __name__ == '__main__':list = ['html', 'js', 'css', ...

  5. python3 遍历列表list 四种方法

    方法一:最简单常用的,用for遍历列表 list = [2, 3, 4] for num in list:print (num) 输出:  2 3 4 方法二:利用python内置函数enumerat ...

  6. python 下标 遍历列表_python中的数据结构与算法(1):列表、元组与字符串

    列表是 python 中最常用.最重要的数据结构之一. 一般来说,我们用列表来管理一组数据对象,这些对象可能是同一类型,也可能是不同类型.列表不仅记录了这些数据对象,而且也记录了它们之间的一种顺序关系 ...

  7. android 遍历对象集合,android-使用rxjava2遍历列表

    我有一个自定义对象列表(List< Item> itemsList).这是我的自定义课程: public class Item { private String itemId; priva ...

  8. python数组遍历输出所有组合_python遍历列表和数组实例讲解

    python遍历实例总结 python同时遍历数组的索引和值的实例 你想在迭代一个序列的同时跟踪正在被处理的元素索引. 获取索引 内置的 enumerate() 函数可以很好的解决这个问题: > ...

  9. 遍历列表python_Python 遍历List的三种方法

    转载至https://www.cnblogs.com/pizitai/p/6398276.html #!/usr/bin/env python # -*- coding: utf-8 -*- if _ ...

最新文章

  1. matlab练习程序(点云表面法向量)
  2. JAVA——基于HttpClient的全国大学英语四、六级考试(CET4CET6)[2019年下半年]查询DEMO
  3. 玩转ECS第8讲 | 服务器迁移中心SMC最佳实践及新特性介绍
  4. delphi7存取配置文件与sqlserver数据库连接_SQL Server基础知识概念要点详细讲解
  5. 大数据技术之 Kafka (第 3 章 Kafka 架构深入 ) Log存储解析
  6. 贪心の纪念品分组(洛谷P1094题题解,Java语言描述)
  7. UVA10474 Where is the Marble?【排序】
  8. 如何用 Linux 技巧大大提高工作效率?
  9. matlab要求 基础,Matlab基础考试要求.doc
  10. 解决scrollView上subView下移20point问题的一种方式
  11. 顺通车间扫码出入库管理系统仓库扫码软件
  12. 分支的操作 - git checkout -b
  13. java愤怒的小鸟教学_JAVA课程设计——愤怒的小鸟(团队)
  14. 揭秘大众点评的大数据实时计算
  15. Redhat7.5升级openssh到8.2p1
  16. 阿里巴巴实习一年之后的感悟
  17. 【python】计算机视觉~舌象图片中舌体倾斜判别(四)
  18. 《数据科学家访谈录》读书笔记1-5
  19. 终于完美解决OneNote无法同步的问题!如此简单!
  20. Aspose.Cells.dll的运用

热门文章

  1. SeetaFace2.0:中科视拓开源跨平台C++商业人脸识别库
  2. Maven的下载与使用
  3. 2019第十届蓝桥杯国赛c++B组真题及题解
  4. 看懂mac OS X的内存状态
  5. python测试之道电子pdf下载_Python接口自动化测试 PDF 下载
  6. 合成孔径雷达干涉测量InSAR数据处理、地形三维重建、形变信息提取、监测等 实践技术应用
  7. 微信小程序:如何在{{}}中使用函数?WXML+WXS
  8. 搭建maya2015 maya2017 API C++ plugin开发环境
  9. 像素大厨可以生成html吗,PxCook(像素大厨)
  10. win10退出登录微软账号,亲测有效可以成功(解决没有改用本地账户;解决没有删除选项)