一、基础
RobotFramework带有丰富的系统关键,使用时无需导入,直接使用,为写自动化用例带来了极大的方便;不能停留在知道或者是会得程度,只有熟练使用各关键字,才能提升自动化用例的写作效率。下面将逐个举例介绍RobotFramework提供的断言关键字。
二、实例
为方便讲解,首先创建三个list变量:list_a、list_b、list_c;以及两个scalar变量:string和name。
@{list_a} create list 1 a ${21} 21 12
@{list_b} set variable 1.0 a ${21} 21 21
@{list_c} create list
${string} set variable pengliwen is in hangzhou
${name} set variable plw
备注:以下提供的用例都是断言成功。
01、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}出现了两次。
02、should be empty 与 should not be empty
should be empty ${list_c}
should not be empty &nb

本文详细介绍了RobotFramework的断言关键字,包括should contain、should not contain、should be equal等,通过实例解析了如何在自动化测试中进行有效的断言操作。

7566

被折叠的 条评论
为什么被折叠?



