gpt4 book ai didi

robotframework - 机器人框架 : run setup for an entire test suite

转载 作者:行者123 更新时间:2023-12-03 18:31:05 25 4
gpt4 key购买 nike

是否可以在 ROBOT 中为整个测试套件运行设置,而不是为每个文件单独运行设置?我想在套件的开头运行安装程序,如果安装程序失败,则根本不运行任何测试用例。

例如,给定以下文件:

*** Settings ***
Test Setup Setup Fails

*** Test Cases ***
Case1
Should Be True 1<2

Case2
Should Be True 2<1

*** Keywords ***
Setup Fails
Should Be True 2<1

我不希望 Case1 和 Case2 都执行。事实上,两者都尝试单独使用安装失败作为安装, output.xml文件具有每个 FAIL 测试用例的状态,并显示一条消息“安装失败...”。相反,我希望 xml 文件具有“失败”套件的状态,并带有“安装失败...”消息,并且测试用例要么不包括在内,要么表明它们尚未运行。

这是 ROBOT 支持的吗?

相反,我想收到一条错误消息

最佳答案

机器人支架 suite setup s。例如:

*** Settings ***
Suite Setup Setup Fails

*** Test Cases ***
Case1
Should Be True 1<2

Case2
Should Be True 2<1

*** Keywords ***
Setup Fails
fail Danger Will Robinson!

以上产生以下结果:
==============================================================================
Example
==============================================================================
Case1 | FAIL |
Parent suite setup failed:
Danger Will Robinson!
------------------------------------------------------------------------------
Case2 | FAIL |
Parent suite setup failed:
Danger Will Robinson!
------------------------------------------------------------------------------
Example | FAIL |
Suite setup failed:
Danger Will Robinson!

2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================

关于robotframework - 机器人框架 : run setup for an entire test suite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33787384/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com