MK Span
MK Span

Reputation: 65

ROBOT FRAMEWORK: How to make test teardown execute only if test case fails?

I could use the "TEST TEARDOWN" keyword in the header but this gets executed after each test case. Is there any way I can do in the code so that it only executes if the test case fails and if otherwise, skips?

Upvotes: 0

Views: 3519

Answers (1)

Helio
Helio

Reputation: 3737

The keyword Run Keyword If Test Failed was created for that case. Better have Robotframework documentation always at hand (and browse trough it at least once).

Here is a special note about it:

This keyword can only be used in a test teardown. Trying to use it anywhere else results in an error.

Upvotes: 2

Related Questions