【问题标题】:In Robot Framework, in the test case teardown phase, how to check whether the current test case is fail or pass?在 Robot Framework 中,在测试用例拆解阶段,如何检查当前测试用例是失败还是通过?
【发布时间】:2014-09-13 11:26:18
【问题描述】:

在 Robot Framework 测试用例中,我们可以创建Teardown 阶段来进行清理活动。

| *Test Case* |
| testcase1 |
|    | [Setup] | Setup Actions |
|    | Do Something | Args |
|    | Do Something | Args |
|    | [Teardown] | Teardown Actions |

| *Keyword* |
| Teardown Actions |
|    | Do Something | Args |
|    | Do Something | Args |

Teardown阶段,如何判断当前测试用例是Pass还是Fail?

我想在测试用例通过的时候做点什么,在测试用例失败的时候做点别的。

【问题讨论】:

    标签: python robotframework testcase test-framework teardown


    【解决方案1】:

    有一个名为${TEST_STATUS} 的变量可以在拆解中使用。这记录在用户指南中的Automatic Variables 部分下。

    您还可以使用Run keyword if test passedRun keyword if test failed 等关键字,它们也只能在拆解时使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      • 2023-03-17
      • 2013-08-30
      • 2014-05-08
      • 2022-08-20
      • 1970-01-01
      • 2016-01-24
      相关资源
      最近更新 更多