Converter类:类型转换
关键字 | 解释 |
---|---|
convert_to_integer | |
convert_to_binary | |
convert_to_octal | 将指定的内容转换为八进制形式 |
convert_to_hex | 将指定的内容转换为十六进制形式 |
convert_to_number | 将指定的内容转换为数字型 |
convert_to_string | |
convert_to_boolean | |
convert_to_bytes | |
create_list | |
create_dictionary |
Verify类:断言类
关键字 | 解释 |
---|---|
fail | 表示测试用例执行失败,停止当前用例执行,下一个用例继续执行 |
fatal_error | 测试用例执行失败,停止当前及之后的所有测试用例的执行 |
should_not_be_true | |
should_be_true | |
should_be_equal | |
should_not_be_equal | |
should_not_be_equal_as_integers | |
should_be_equal_as_integers | |
should_not_be_equal_as_numbers | |
should_be_equal_as_numbers | |
should_not_be_equal_as_strings | |
should_be_equal_as_strings | |
should_not_start_with | 不应该以某个字符串为起始 |
should_start_with | |
should_not_end_with | 不应该以某个字符串为结束 |
should_end_with | |
should_not_contain | 不应该包含 |
should_contain | |
should_contain_any | 应该包含1、2、3、… 或 列表 |
should_not_contain_any | |
should_contain_x_times | 应该包含x次 |
get_count | 返回item2在item1中被找到的次数 |
should_not_match | 类似正则匹配 |
should_match | |
should_match_regexp | 正则匹配 |
should_not_match_regexp | |
get_length | 获取长度 |
length_should_be | 判定长度 |
should_be_empty | |
should_not_be_empty |
Variables类:
关键字 | 说明 |
---|---|
get_variables | 获取一个包含当前作用域内的所有变量的字典 |
get_variable_value | 获取变量的值,若不存在,返回自定义值 |
variable_should_exist | 判断变量是否存在。若不存在,输出自定义msg |
variable_should_not_exist | 判断变量是否存在。若存在,输出自定义msg |
replace_variables | 替换变量值 |
set_variable | 设置变量值 |
set_test_variable | 设置测试用例变量 |
set_task_variable | 设置测试用例变量的别名,适合任务 |
set_suite_variable | 设置测试套件变量。对套件下所有用例生效 |
set_global_variable | 设置全局变量。对所有测试用例和套件生效 |
RunKeyword类
关键字 | 说明 | 示例 |
---|---|---|
run_keyword | 运行关键字xx。返回运行结果 | |
run_keywords | 运行多个关键字xx1、xx2 | run keyword xx1 and xx2 |
run_keyword_if | 当条件满足时运行关键字xx | |
run_keyword_unless | 当条件不满足时运行关键字 xx | |
run_keyword_and_ignore_error | 运行关键字并忽略错误 | |
run_keyword_and_return_status | 获取关键字的返回值,主要是true or false | |
run_keyword_and_continue_on_failure | 失败后仍运行指定关键字 | |
run_keyword_and_expect_error | 运行关键字并预期错误 | |
repeat_keyword | 重复运行关键字 | |
wait_until_keyword_succeeds | 等待关键字执行成功,可设置超时时间和重试间隔时间 | |
set_variable_if | 在某种条件下,设置变量为xx1,否则为xx2 | |
run_keyword_if_test_failed | 当用例失败时,运行关键字 | |
run_keyword_if_test_passed | 当用例通过时,运行关键字 | |
run_keyword_if_timeout_occurred | 当用例或关键字运行超时时,运行关键字 | |
run_keyword_if_all_critical_tests_passed | 当关键用例通过时,运行关键字 | |
run_keyword_if_any_critical_tests_failed | ||
run_keyword_if_all_tests_passed | 当所有用例通过时,运行关键字 | |
run_keyword_if_any_tests_failed |
Control类
关键字 | 说明 |
---|---|
continue_for_loop | 跳出本层循环,执行下一层循环https://blog.csdn.net/weixin_30326745/article/details/97975588 |
continue_for_loop_if | 在某种条件下,跳出本层循环,执行下一层循环 |
exit_for_loop | 退出循环 |
exit_for_loop_if | 在某种条件下,退出循环 |
return_from_keyword | 类似python的return |
return_from_keyword_if | |
run_keyword_and_return | 运行关键字并返回该关键字的结果 |
run_keyword_and_return_if | 当条件满足时,运行关键字并返回该关键字的结果 |
pass_execution | 标记测试用例执行成功 |
pass_execution_if | 当满足条件时标记测试用例执行成功 |
Misc类
关键字 | 说明 |
---|---|
sleep | |
catenate | 连接字符串 |
log | |
log_many | |
log_to_console | |
comment | 注释 |
set_log_level | 设置日志级别 |
reload_library | 重新检查指定库 |
import_library | 在test suite导入库 |
import_variables | 导入变量 |
import_resource | 导入资源 |
set_library_search_order | 判断关键字存在 |
get_time | 获取时间 |
evaluate | 计算python表达式并给出结果 |
call_method | |
regexp_escape | python中的re.escape() |
set_test_message | 设置用例的message,在测试报告message列显示 |
set_test_documentation | 设置测试用例文档说明 |
set_suite_documentation | 设置测试套件 文档说明、 |
set_suite_metadata | 设置测试套件的原数据 |
set_tags | 设置tag |
remove_tags | 去除tag |
get_library_instance |