question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keywords in test case files with dots in name do not have precedence over imported keywords

See original GitHub issue

I created resource res.robot like below:

*** Keywords ***
ok
	Log	This is external res.ok
res.keyword
	Log	This is external res.res.keyword

Then I created test suite Test.robot, which inside has keywords res.res.keyword and res.ok like below:

*** Settings ***
Resource	res.robot

*** Test Cases ***
Test Check
	res.ok
	res.res.keyword
	
*** Keywords ***
res.ok
	Log	This is internal res.ok
res.res.keyword
	Log	This is internall res.res.keyword

According to documentation http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#handling-keywords-with-same-names 1. Created as a user keyword in the same file where it is used. These keywords have the highest priority and they are always used, even if there are other keywords with the same name elsewhere.

What I see in the output is that RF call resource file keywords instead of corresponding internal, so I got message from res.robot file:

20161118 09:32:03.353 : INFO : This is external res.ok
20161118 09:32:03.355 : INFO : This is external res.res.keyword

Is it expected behaviour or a new issue?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pekkaklarckcommented, Dec 29, 2016

Scrap that! We can fix the original problem by always first looking does the test case file have the specified keyword. This can be done regardless does the keyword name have dot or not. If the test case file doesn’t have such keyword, we can then first look from resources/libraries if the keyword has a dot. This implementation ought to cause no backwards compatibility problems and ought to also be in sync with the documentation.

0reactions
pekkaklarckcommented, Dec 29, 2016

After implementing the change, our own tests showed that it can break tests using embedded arguments. For example, if we have keyword like ${embedded} args in a resource file and use it like resource.Embedded args, variable ${embedded} nowadays gets value Embedded but after the change it would get resource.Embedded. This would be too big change in a minor version, and I’m not sure would that really make sense even in a major version. I guess the current implementation is actually the best one. We just need to document it better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Robot Framework User Guide
Creating test cases from available keywords. Tasks, Creating tasks using available keywords. Single file can only contain either tests or tasks. Keywords ......
Read more >
RobotFrameworkAdvancedGuide < EMI < TWiki
Keywords can be imported from test libraries or resource files, or created in the keyword table of the test case file itself. The...
Read more >
BuiltIn - Keyword Documentation - Robot Framework Hub
If a library is imported with a custom name, the name used to get the instance must be that name and not the...
Read more >
Robot Framework Tutorial #11 - Move User Defined Keywords ...
Get all my courses for USD 5.99/Month - https://bit.ly/all-courses-subscription❖ FREE Training's at https://training.rcvacademy.com ❖ In ...
Read more >
Operators and Identifiers in Power Apps - Microsoft Learn
Some of these operators are dependent on the language of the author. ... Identifier, 'Account Name', Identifiers that contain special ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found