1

In Robot Framework test case, we can create Teardown phase to do clean-up activities.

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

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

In the Teardown phase, how can we check whether the current test case is Pass or Fail?

I would like to do something when the test case Pass, and do something else when the test case Fail.

4

1 回答 1

2

There is a variable called ${TEST_STATUS} that you can use in a teardown. This is documented under the section Automatic Variables in the user guide.

You can also use keywords such as Run keyword if test passed and Run keyword if test failed, which also only work in a teardown.

于 2014-09-13T11:53:54.087 回答