Common Resource file usage for multiple RF projects in eclipse

Hi All,

We are trying to have a common resource file and locator file.py which can be used across multiple RF projects in eclipse. So, we tried placing the resource file in a location outside the eclipse project’s directory and tried to use the same in a RF project.

After importing the resource file, it is showing us a warning that,

  • RED does not support importing resources located outside of workspace. Keywords from this resource will not be recognized. Try to use Quick Fix (Ctrl+1) to link folder into the project.
  • Path ‘C:/RobotCommon/CommonUpointKeywords.resource’ points to location outside your workspace
  • Path ‘C:/RobotCommon/CommonUpointKeywords.resource’ is absolute. It is preferred to use relative paths.

image
Not able to do the Quick Fix in order to link this to the project.

Is there any way to have the common resource file used with all the keywords being recognized in the Test Suite?

Thanks!

From the error it looks like you need to create a symbolic link to the external folder inside your working project. I think that should fix the error.(Note: I am not using eclipse so its more of a guess :slight_smile: )

Put shared resource files into separate git repository and add that new repository as git submodule or subtree (or any similar tooling that allows combining multiple git repos into single checkout).

We do migrate common resource files to a library in a separate python project with its own lifecycle.
Our pipeline deploy such libraries in to our own pypi storage on Sonatypr Nexus from where all our python environments can pull python dependencies.

Robot projects then only need to pull the common resource library from nexus.

The benefit of a library with an own lifecycle is that all your projects can rely on different versions of your common resource. If you copy a resource file in to every project, every project must be adapted in case of changes.

is this lib then installed via pip?
Did you manage to use the auto code completion feature with imported lib?
I need to set an absolute path eg Resource …/…/…/venv/lib64/python3.9/site-packages/KeywordLibrary/

in order to get this working.

Yes, all works.

Auto completion depends on your ide. If done right, your keyword should be imported like any other library:

*** settings ***
Library    Keyword library

If you must relative path, it either means your library is not in pythonpath (like installed to the wrong python env).

Or maybe your library module has a different name than the library class.

In your library it think the folder structure must be:

  • (folder) KeywordLibrary
    – (file) KeywordLibrary.py
    — (class) KeywordLibrary

If anything has a different name your reference to the library is somehow different (but not comprehensive for me).