本文主要是介绍RobotFramework测试框架(5)-高级特性,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
处理同名关键字
处理超时
一些关键字可能需要很长时间执行,RF允许为测试用例和用户关键字设置超时,如果一个测试或者关键字在指定时间内没有完成,那么就会被强制停止执行。
使用这种方法停止关键字会导致测试库,测试环境和被测系统处于不稳定状态,所以建议没有其他更安全的方法时,才使用超时设置。
Test case timeout
*** Settings ***
Test Timeout 2 minutes*** Test Cases ***
Default timeout[Documentation] Default timeout from Settings is used.Some Keyword argumentOverride[Documentation] Override default, use 10 seconds timeout.[Timeout] 10Some Keyword argumentVariables[Documentation] It is possible to use variables too.[Timeout] ${TIMEOUT}Some Keyword argumentNo timeout[Documentation] Empty timeout means no timeout even when Test Timeout has been used.[Timeout]Some Keyword argumentNo timeout 2[Documentation] Disabling timeout with NONE works too and is more explicit.[Timeout] NONESome Keyword argument
User keyword timeout
*** Keywords ***
Hardcoded[Arguments] ${arg}[Timeout] 1 minute 42 secondsSome Keyword ${arg}Configurable[Arguments] ${arg} ${timeout}[Timeout] ${timeout}Some Keyword ${arg}Run Keyword with Timeout[Arguments] ${keyword} @{args} &{kwargs} ${timeout}=1 minute[Documentation] Wrapper that runs another keyword with a configurable timeout.[Timeout] ${timeout}Run Keyword ${keyword} @{args} &{kwargs}
这篇关于RobotFramework测试框架(5)-高级特性的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!