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
Can't import diffrent libs and use the same alias #2377
*** Test Cases ***1111@{a} = Create list 5 2 3
import library Collections WITH NAME p1
reload library p1
import library String WITH NAME p1
reload library p1
p1.Sort List ${a}
log ${a}
p1 is Collections not String because:
robot/running/namespace.py:128
if lib.name in self._kw_store.libraries:
LOGGER.info("Test library '%s' already imported by suite '%s'"
% (lib.name, self._suite_name))
The problem you describe is true and is caused by Robot caching libs and resources by their names. This caching has caused also other problems and it is possible that the functionality will change at some point. Such changes are potentially backwards incompatible and can thus only be done in a major release like RF 3.1.
Could you clarify your use case for importing different libs with same name? Could you just use a variable containing the library name instead?
I need to import my libs in every testcase with test setup because of different arguments, and these cases are in one testsuite. I find that the second case's lib does not work with correct args because the lib does not be reimported in fact
At our site we have libraries that are basically only used as a remote library (using robotremoteserver), so that the suite is portable between different testbeds which all have their own remote library instance. To achieve this we pass in a configartion file containing all information regarding this testbed incl. IPs and ports of the remote libraries.
But when a tester creates his suite (in RIDE) he also wants to have all the auto-completion and documentation. So the idea was to import the library locally to get only the documentation and later replace this instance at runtime with the remote one:
*** Settings ***
Library Testcenter WITH NAME stc # for documentation in RIDE only
*** Test Cases ***
MyTestCase
${ip} ${port} Get Testcenter
Import Library Remote ${ip}:${port} WITH NAME stc # the actually used library instance
stc.Streamblock Ethernet Add ....
As this is currently not working we have to work with libspec XML files, but it would be easier if we had to only deploy the libraries.
Activity
pekkaklarck commentedon May 26, 2016
First of all, adding syntax highlighting for your Robot Framework and Python examples would make it a lot easier to understand the description. See here how to do it: https://guides.github.com/features/mastering-markdown/. Also, is
Reload Librarysomehow relevant in these cases?The problem you describe is true and is caused by Robot caching libs and resources by their names. This caching has caused also other problems and it is possible that the functionality will change at some point. Such changes are potentially backwards incompatible and can thus only be done in a major release like RF 3.1.
Could you clarify your use case for importing different libs with same name? Could you just use a variable containing the library name instead?
ddoraemon commentedon Oct 25, 2016
I need to import my libs in every testcase with test setup because of different arguments, and these cases are in one testsuite. I find that the second case's lib does not work with correct args because the lib does not be reimported in fact
scathaig commentedon Nov 15, 2016
At our site we have libraries that are basically only used as a remote library (using robotremoteserver), so that the suite is portable between different testbeds which all have their own remote library instance. To achieve this we pass in a configartion file containing all information regarding this testbed incl. IPs and ports of the remote libraries.
But when a tester creates his suite (in RIDE) he also wants to have all the auto-completion and documentation. So the idea was to import the library locally to get only the documentation and later replace this instance at runtime with the remote one:
As this is currently not working we have to work with libspec XML files, but it would be easier if we had to only deploy the libraries.
pekkaklarck commentedon Feb 4, 2017
This is highly related to #2106. Needs to be decide about these together.