如何在机器人框架中使用监听器
How to use Listeners in robot framework
我正在使用 python 2.7.15 和机器人版本 3.0.4。我有一个要求只截取失败测试用例的屏幕截图。 Whosebug 中的一些帖子说必须使用侦听器来操纵测试结果。或者是否有相同的关键字?
不确定你想要什么,但这是我在 RF 级别使用的:
Global Test Teardown
Run Keyword If Test Failed Capture Page Screenshot
或者,您应该可以在 Python 中执行类似的操作:
def global_test_teardown(testStatus=BuiltIn().get_variable_value("${TEST STATUS}")):
seleniumlib = BuiltIn().get_library_instance('SeleniumLibrary')
if testStatus=="FAIL":
seleniumlib.capture_page_screenshot()
我正在使用 python 2.7.15 和机器人版本 3.0.4。我有一个要求只截取失败测试用例的屏幕截图。 Whosebug 中的一些帖子说必须使用侦听器来操纵测试结果。或者是否有相同的关键字?
不确定你想要什么,但这是我在 RF 级别使用的:
Global Test Teardown
Run Keyword If Test Failed Capture Page Screenshot
或者,您应该可以在 Python 中执行类似的操作:
def global_test_teardown(testStatus=BuiltIn().get_variable_value("${TEST STATUS}")):
seleniumlib = BuiltIn().get_library_instance('SeleniumLibrary')
if testStatus=="FAIL":
seleniumlib.capture_page_screenshot()