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

Resources importing #45

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

Resources importing #45

Mario-P opened this issue Oct 5, 2016 · 5 comments

Comments

@Mario-P
Copy link

Mario-P commented Oct 5, 2016

Hi,

I have some issue with importing Resources in RED in Eclipse. I have following structure of my tests:

/robot_tests/Common/
/robot_tests/Site/

My RED project location points to /robot_tests.

Inside Site directory I have site_resource.robot where I keep default values of variables per site (there can be many sites with different values). site_resource.robot has to be imported in robot files that are inside Common directory. I have tried different settings in Referenced libraries -> Paths section: I added both Common and Site there with full paths, added Common and Site without paths and changed relativeness to PROJECT and WORKSPACE. Only solution that has been working was when I imported site_resource.robot with path (../Site/site_resource.robot) and this is not acceptable solution :(.

In RIDE when you add both Common and Site to Pythonpath you can easily use keywords and variables from them in any other place. Is that possible in RED?

Thanks,
Mariusz

@Mario-P
Copy link
Author

Mario-P commented Oct 5, 2016

Update.
I see that proper settings of Referenced libraries -> Paths is Common and Site with path relativeness set to PROJECT. Then when I hover mouse over one of the entries in Path section I can see proper path.

Now I created new directory inside Sites and suite inside this new directory and tried to import resource sire_resource.robot and it is also not possible. I'm guessing something is not ok with importing.

@KrzysztofJozefowicz
Copy link
Contributor

Hi
Indeed RED does not fully support importing resources and var files when those files are imported using parameter in path either declared in the same file or in python file (loclal or global).
It only works using VariableMappings from red.xml in General Tab.
Following suite with res.robot and vars in "folder" subdirectory will PASS but RED shows errors for not known res_kw and ${var_1}.

*** Settings ***
Resource     ${resource}/res.robot
Variables    ${resource}/vars.py
*** Variables ***
${resource}  folder

*** Test Cases ***
t1
   log  ${var_1}
   res_kw
*** Keywords ***

I have created internal Jira as this is an enhancement to work the same as with parametrized path to libs

@Mario-P
Copy link
Author

Mario-P commented Oct 6, 2016

I'm not sure if we are talking about the same things, so once again with pictures :).

  1. I'm creating a RED project (location d:\red_tests). project_structure
  2. I'm creating common_resource.robot inside with some keywords.
  3. I'm putting "./" to pythonpath with relativeness to project in red.xml. red_xml
  4. I'm creating folder Tests and inside a suite - RED_test_suite.test_suite

suite code:

*** Settings ***
Resource          common_resource.robot

*** Test Cases ***
TestCase
    RED test keyword

As you see I have not used any parameters while importing resource and still that resource is not recognized.

So I'm referring to the fact that RED is not recognizing resource files that are already in pythonpath (RIDE deals with that kind of importing).

@KrzysztofJozefowicz
Copy link
Contributor

ok, we talked about different thing, resource resolving from PythonPath should also be added although usage for us is controversial ;) .
I have created another issue in Jira for that.

@sumnanda
Copy link

sumnanda commented Sep 4, 2018

Hello,
I am having similar issue as stated above. Can you please tell me how can this be resolved?

Thanks,
Sanam

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

4 participants