Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when using keyword from nested library. #50

Closed
Mario-P opened this issue Oct 14, 2016 · 12 comments
Closed

Warning when using keyword from nested library. #50

Mario-P opened this issue Oct 14, 2016 · 12 comments

Comments

@Mario-P
Copy link

Mario-P commented Oct 14, 2016

There is warning displayed when keywords from nested library are used:
warning
Project structure:
structure

Is there anything that can be done not to have such warnings?

@adam-wypych
Copy link
Contributor

We have such enhancement in our backlog, but currently such option is not available. We will check possibility to implement is ASAP.

@KrzysztofJozefowicz
Copy link
Contributor

I moved your idea somewhere at the top as it was also requested from internal clients thus it looks that it would be used regularly. First we need to fix reported bugs.

@KrzysztofJozefowicz
Copy link
Contributor

This will be provided in 0.7.3 release.

@Mario-P
Copy link
Author

Mario-P commented Dec 23, 2016

It is still the same in 0.7.3.

@KrzysztofJozefowicz
Copy link
Contributor

Yes, this error/warning is still 0.7.3 as the problem is valid one. What 0.7.3 allows is to suppress such issues.
Go to Windows -> Preferences -> Robot Framework -> Errors/Warnings and under Code styles you will find "Keyword from nested library" with default value "warning". You can change it to info or ignore if you need to.
After the change you can revalidate file or whole project by ctrl+F5.

@humbienri
Copy link

Hello @KrzysztofJozefowicz, first off thank you guys for all of this work that you've gifted us! It's invaluable! I am wondering what you mean by "problem is valid one". Why is it valid? Or how is it that it's a problem? Is it an anti-pattern that one should avoid? I am new to RED and am enjoying using it although I need to figure out how to make Eclipse (portable version) more responsive and snappy. On my laptop it does act a little "choppy."

@michalanglart
Copy link
Collaborator

Hi @humbienri

I think the opinions vary depending on user so I'm not going to tell you if that's anti-pattern or a pattern. As to myself I would prefer to keep dependencies explicitly defined rather than implicitely by transitive relations. Once you have such transitive dependencies you need some good code navigation support as it would be harder to navigate between files in e.g. some simple notepad-based environments.

On my laptop it does act a little "choppy."

What do you mean by that?

@adam-wypych
Copy link
Contributor

adam-wypych commented Dec 21, 2018

I totally agree with @michalanglart that is not possible to make correct judgment about it is pattern or anti-pattern [this is probably why it is only warning] without view on concrete usage. From my experience, I can only say, that usage of library from resource file only creates problem (at least with readability) if nesting level (starting form test suite file) will be greater than 1 or amount of libraries inside such file is equal to 1 (because it is totally useless and you can inline library import directly in every test suite).

So in other words if you are using your resource file pretty much as __init__.py is generally fine.

For more see below links:
[1] https://stackoverflow.com/questions/48524292/robot-framework-multiple-resource-files-accessing-the-same-library
[2] https://docs.plone.org/external/plone.app.robotframework/docs/source/robot.html

@humbienri
Copy link

humbienri commented Dec 23, 2018

Hello @michalanglart,

What I mean by "choppy" is that RED is not very smooth. Meaning the RED UI is not the most responsive. Although I guess in reality it could be that Eclipse is the one not being responsive. For example, I'll hit Ctrl+D to delete a line and I can actually see a small pause/lag before the line is truly removed! In general RED/Eclipse feels a bit laggy or slow! Still useful though.

As to the "Keyword from nested library" warning and being explicit vs. implicit you mean writing

SeleniumLibrary.Click Button

instead of just

Click Button

? If so, then that would result in some pretty verbose code/tests!?

Comments welcome.

@michalanglart
Copy link
Collaborator

Hi,

Do you edit big files? We do notice UI slowness but for files having e.g. 8000 lines (see #259). Do you notice RED not being greatly responsive overall or only in editor? What's your machine hardware?

As to the latter: we were discussing Library imports, not keyword usage. The "keyword from nested library" is being reported when:

  • we have a resource file b.robot which in it's setting section imports e.g. library X
  • we have another file (a.robot, suite or resource) which imports b.robot in Resource setting
  • inside a.robot we are using keyword Y from library X

In setup as above a.robot is importing library X but not "explicitly" via Library setting, but transitively because the resource file it imports is importing this library ("implicitly").

@humbienri
Copy link

Hello again,

No I am not editing big files. Not big at all as they are pretty new and I'm the only one that's been working on them. No more than 200 LOCs I'd say. The system I am referring to is a Windows 10 laptop, 64bit OS, 16GBs of RAM if I remember correctly.

It's not a super beast in terms of hardware but it's also not an old laptop like my personal one. One of the reasons I keep going back to VSCode for editing some of my *.robot files is because VSCode is so much more responsive compared to RED, but I do like RED.

Thanks again @michalanglart!

@balaji-githubstore
Copy link

Screenshot (340)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants