Release 3.0.1 introduced changes from issue #2404. Now all missing keywords are treated as syntax errors, which can not be caught with other keywords such as Run keyword and ignore error. It also stops the teardown from continuing on failure.
This functionality is understandable for actual syntax errors, but clashes with dynamic library imports. It is now dangerous to run dynamically imported keywords in teardowns, as failure before the Import library call results in a syntax error and partially executed teardown.
As far as I can see, there is no way to continue the teardown in this situation, or check if the import has been done or not. (or am I mistaken?)
Attached is a test case which highlights the problem. (The dynamic import for telnet is not actually needed here).
*** Settings ***
Test teardown Close connections
*** Test Cases ***
Dynamic imports
Import library Telnet WITH NAME ClientOne
Fail Something goes wrong!
# This does not run:
Import library Telnet WITH NAME ClientTwo
*** Keywords ***
Close connections
ClientOne.Close connection
ClientTwo.Close connection
Log This line should run always
This is an unfortunate side effect of the change, especially in a minor release, but I still think the change itself was a good idea. Have you found any good workaround? I guess you ought to be able to use the Keyword Should Exist keyword somehow.
The same issue was reported also as #2661 where same keyword was found multiple times. Since the change in #2404 is causing issues for multiple users, and especially because the change was done in a minor version, we need to think what to do with it. Alternatives include:
I'm starting to like the latter option more but need to think about this and also see how big the change would be. If the change is big, it may not be safe in RF 3.0.3.
Decided not to consider errors related to finding keywords syntax errors and submitted #2792 about it. This regression will be fixed once that issue is fixed.
Most helpful comment
Decided not to consider errors related to finding keywords syntax errors and submitted #2792 about it. This regression will be fixed once that issue is fixed.