You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Logging unexecuted keyword has unnecessary overhead if keywords are not found #5051
In an initial effort to make my testing repo compatible with both SeleniumLibrary and Browser, I added some conditional logic to run specific keywords based on the library chosen at test execution. More specifically, I used a global variable ${AUTOMATION}, declared in an argument file, which determines the library used here.
Basic example:
IF '${AUTOMATION}' == 'SeleniumLibrary'
SeleniumLibrary.Keyword_1
SeleniumLibrary.Keyword_2
SeleniumLibrary.Keyword_3
ELSE IF '${AUTOMATION}' == 'Browser'
Browser.Keyword_1
Browser.Keyword_2
Browser.Keyword_3
END
Initial results with a converted test showed a degrade in performance. If SeleniumLibrary is used, the Browser keywords are not ran, but RF appears to hang on the unmet 'ELSE IF' condition for several seconds in this example:
After some discussion in Slack, I believe it's been confirmed that the root cause is due to the Browser library not being imported, which is potentially causing some overhead on the RF side. When Browser library is not imported, I get the slowness, but if I import Browser, that slowness is eliminated and I get a much more expected result:
Reproducible in both RF 6.1.1 and RF 7.0.
Python 3.10.12
Ubuntu 22.04.3
We want to log unexecuted IF/ELSE and TRY/EXCEPT branches to show what would have happened in different conditions.
In these branches we try to resolve used keywords so that we can show their origin. In other words, if you use Log, we resolve it and show BuiltIn.Log in the log file instead of just Log.
If a keyword isn't found, we log just whatever was used. The keyword wasn't executed so it not being found isn't considered an error.
When a keyword isn't found, we try to see are there some keywords that have a similar name and propose them in the resulting error message. This helps, for example, with typos.
Finding similar matches has some overhead.
In this particular case the error message is ignored so all the effort spent for finding similar matches is wasted.
In the end the root cause is pretty much the same as in #4659. The fix is also the same, we just need to disable recommendations in this context.
changed the title [-]Performance Issue with IF/ELSE Conditionals when keyword library is not imported[/-][+]Going through unexecuted keyword has unnecessary overhead if keywords are not found[/+]on Feb 25, 2024
changed the title [-]Going through unexecuted keyword has unnecessary overhead if keywords are not found[/-][+]Logging unexecuted keyword has unnecessary overhead if keywords are not found[/+]on Apr 4, 2024
Activity
pekkaklarck commentedon Feb 25, 2024
This is why the problem occurs:
Log, we resolve it and showBuiltIn.Login the log file instead of justLog.In the end the root cause is pretty much the same as in #4659. The fix is also the same, we just need to disable recommendations in this context.
[-]Performance Issue with IF/ELSE Conditionals when keyword library is not imported[/-][+]Going through unexecuted keyword has unnecessary overhead if keywords are not found[/+]Make going through unexecuted keywords faster.
Make going through unexecuted keywords faster.
[-]Going through unexecuted keyword has unnecessary overhead if keywords are not found[/-][+]Logging unexecuted keyword has unnecessary overhead if keywords are not found[/+]