-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Hi,
I have a user keyword that may leave a mess if it's not cleaned up after. So I have a user keyword teardown which does that. But if it is stopped early due to a test case timeout, the teardown is not executed. What to do?
Example:
# test.robot
*** Test Cases ***
Test with timeout
[Timeout] 2s
Keyword with teardown
Test which will find a mess
Fail Oh what a mess! Why did somebody not clean up after themselves!?
*** Keywords ***
Keyword with teardown
[Setup] Log Doing the setup
Sleep 24h # This hangs
[Teardown] Log Doing cleanup # This is not executed, so how do I clean up?
Run:
$ robot test.robot
==============================================================================
Test
==============================================================================
Test with timeout | FAIL |
Test timeout 2 seconds exceeded.
Also keyword teardown failed:
Test timeout 2 seconds exceeded.
------------------------------------------------------------------------------
Test which will find a mess | FAIL |
Oh what a mess! Why did somebody not clean up after themselves!?
------------------------------------------------------------------------------
Test | FAIL |
2 tests, 0 passed, 2 failed
==============================================================================
Output: /home/gschwaer/tests/robot-framework/output.xml
Log: /home/gschwaer/tests/robot-framework/log.html
Report: /home/gschwaer/tests/robot-framework/report.html
Unfortunately
- the documentation on Test case timeout only talks about Test case teardown,
- the documentation on User keyword timeout is irrelevant here, and
- the documentation on User keyword teardown does not explain the behavior on any timeouts.
Thanks for you help in advance!