Comments (5)
Thanks for input, we will have closer look into it.
For now, RED uses relative paths around project/workspace,absolute paths if specified or check local test file directory when only filename was given.
from red.
Thanks. We have multiple reusable resource files kept in single common directory and we import them in test case with only filename. And we set PYTHONPATH to that common directory before running pybot cli. So same test case files will not work as it is in RED.
Is there any workaround like setting is red.xml file? Can we set additional search path in red.xml?
from red.
We had a fruitful discussion about searching resources files in PythonPath.
We decided that we will not support such scenario because various reasons.
Robot provides flexibility in many areas ( like above or keyword naming for instance) which are handy but on the other hand can cause problems. In our opinion PythonPath should only be used for Python specific elements (like libraries) and not for Robot framework artifacts.
We see such usage as anti pattern which should be avoided if possible :
- by placing common resources in PythonPath, you mix test material with environment setup. It can lead to problems with transfer tests between different testbeds ( you may not have proper access rights to modify PythonPath )
- resource file name collision can happen but it will be hidden. Which resource will be returned to Robot if there are multiple files with the same name in PythonPath? I have not tested this but risk is that depending on OS and timing results may vary (difficult to debug)
- system performance could be affected while editing and testrun as Robot needed to search dir tree for files instead of using explicit paths
- test maintenance is easier when each test suite provide path to used resources
- debugging in RED could be tricky as we would have to jump to files outside workspace when executing Step In option.
I suppose you already have your test cases and common resources in some kind of version control so common resources should be somewhere in the directory tree adjacent to test files.
One way is to use linking resource files/folders to RED project (New -> File -> Advanced -> Link to file .. and Import -> General -> File System -> Advanced ...) in the same folder as test suite files. This way example.robot will be seen by RED. If there are problems with test execute or test debug you can have a look into Run Configurations if any arguments needs to be passed to Python
Other way (my recommendation) is to spend a little time and do mass search & replace/update of resource usage in test suites. You can use Robot ${EXECDIR} (path where output.xml and report.html is generated, this is also Project path in RED) variable to create common path to resources so in any depth of test suites dir tree, same path to resource can be used.
Additionally (for RED v0.5) current path to RED project have to be mapped in variable mappings (in 0.6.x we will handle it statically per project ). This way your tests will be environment independent and easier to maintain with less prone to hidden problems.
from red.
Thanks a lot for detailed reply. At present it solved my problem with your suggestion of linking resource file.
from red.
I am having the same issue initially described by @pvshewale.
Created resource file example.robot inside E:\test
Added E:\test to system environnment variable PYTHONPATH
Opened RED and tried to import above resource file as
Resource example.robot
RED fails to import resource file and gives error like "file does not exist"
I do not understand how to implement the fix offered by @KrzysztofJozefowicz. Could either of you explain in more depth? Ultimately, this behavior works very well in RIDE (add a library containing Robot resources to "Ride - Preferences" -> Importing -> PYTHONPATH, like E:\test as above, then the import using a relative path [e.g., "Resource example.robot"] works perfectly). I understand what @KrzysztofJozefowicz was saying about this being an anti-pattern, but I have little choice as my organization heavily relies on this relative import path functionality.
from red.
Related Issues (20)
- eclipse+RED Robot Editor,False positive error HOT 1
- Cannot find RED.exe or any .exe files in RED master. Perhaps I'm the fool but it's really not clear to me how to go about installing RED without an executable file. HOT 1
- any plan to support robot framework 4.0? HOT 2
- Successfully imported python library does not see its keyword in run HOT 1
- Cannot use Undo in Eclipse HOT 4
- Guideline for Developer : How to build and debug Red Plugin source code HOT 2
- An internal error occurred during: "Looking for Python installations". HOT 2
- How to rerunfailedsuites using maven plugin
- With latest version of Robot Framework i am unable to get assistance calls HOT 1
- RED can not support adding library by pyc files
- How can I configure the working directory for a test execution? HOT 4
- 'Building' has encountered a problem. An internal error occurred during. "Building" HOT 5
- Unable to communicate with XML-RPC server HOT 2
- Missing requirement: org.eclipse.equinox.app 1.4.400.v20191212-0743 requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=1.7))' but it could not be found
- does RED editor support Robot framework 5? HOT 2
- Library not being recognized using Red HOT 3
- Error while building new Project
- Unable to open .robot files after RED installation in Eclipse: Unable to initialize Suite editor HOT 3
- Is Eclipse and RED supporting Robotframework 6.0?(Project is not building in Eclipse with RED "https://sourceforge.net/projects/red-robot-editor/files/repository/0.9.1/)
- Library specification generation problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from red.