-
Notifications
You must be signed in to change notification settings - Fork 43
Import Failure when Library resource has a variable #152
Comments
This is by design and correct behaviour. To be able to know the value of the ${res_LAB} variable, plugin should run the tests. The plugin only parses the data and is not able know what values the variable contains. This can be improved and I am open to ideas (and pull request) to improve the plugin. |
Is this still a problem for you and do you have an opinion how it should be improved? Or can we close the issue? |
In Sublime 2, this seemed to work. When clicking a variable which maps to value set in ${res_LAB}, it would list all the files with that variable. Then, I would manually select which one I was interested in. Improvement Suggestion: Secondly, can there be a setting in the plugin to point to a folder where all my resource files are located? (Maybe you already have that and I missed it) The database builder would ignore any Library declarations in the script and build a database based on whatever is in the folder instead.
|
There is major difference between the 1.x.x and the current version. The 1.x.x version would offer keyword completion from all found resources and libraries, regardless was the resource or library actually imported. The latest version actually offers keyword completion from resources and libraries which user have actually imported (in current or child files). Because your resource import parsing fails, because it contains a variable in the file path, the plugin can't provide keyword completion from that file or any of the child imports. There are many ways to solve the problem: b) Manually configure variable(s) content to settings, so that resource or library can be implemented. c) Also parse automatically content. d) Combination of the b&c. But I am open to new ideas and suggestions how to fix the problem. |
For a fairly large RF project, using variables in Resources and Libraries is (in my opinion) a best practice:
I personally would be happy with just option b, ie. having the ability to define those few variables I need for imports to work. Maybe having a dict in Settings file, where you can define "project variables" and those are replaced when building a database? I could also take a stab at it, if you can point me to correct direction. |
I have been thinking to same direction, b, would be the best way to go. I am away from my PC (holidays) but as a quick look https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/dataparser/data_parser/data_parser.py would be good place to start. The only problem on this is that the data_parser object is independent from Sublime and accessing the Sublime settings, to read the correct variable value can be problematic. But if that problem can be solved, then I would take this route. |
@Tattoo If you are still interested to make this, there has been quite lot of refactoring on the internal database functionality. Therefore it might be good idea to rebase with the master. |
I have been thinking this problem and perhaps it would be best to define the variable values in the (user) settings file. Then when creating the internal database write the variable values to a file. Then when process which creates the database tables, take the file as argument and when scanning would replace the values during the scanning process. |
Import Error on Windows Sublime 3114, Robot Framework Assistant 4.1.0 when a variable is in the Library resources
Example:
When Create Database is run, the log file reports an import error (from
scan_index.log
)('Import failure on file: c:\\users\\user\\documents\\_robotwork\\selfcare\\test_cases\\testscript.txt,', 'could not locate: ../resources/${res_LAB}.txt')
Curiously, we tried adding
${res_LAB}
to"robot_framework_builtin_variables":
to see if it gets ignored, but no luckHere is the User Settings file:
The text was updated successfully, but these errors were encountered: