intellibot icon indicating copy to clipboard operation
intellibot copied to clipboard

Support for resolving paths that are given as Robot variables

Open ghost opened this issue 9 years ago • 19 comments

Hi,

It would be great if plugin could resolve paths to resources that are given as Robot variable. For instance: Now plugin is working good once we put the absolute path to resource eg.

Resources /home/test/lib/keywords.robot

Keywords resolving works in such case.

Once I put some Robot variable in variables section for instance in the same testfile eg.

${RESOURCE} /home/test/lib/

And then:

Resource ${RESOURCE}keywords.robot

Keywords resolving doesn't work in such case. There is message from PyCharm: "Import file not found"

ghost avatar Nov 10 '15 09:11 ghost

+1 None of current Robot plugins currently support this. Even if all the plugin did was to read in a robotvariables.py file it would be great.

twbecker avatar Dec 21 '15 14:12 twbecker

I'm having the same problem. I'm trying to use the built in global robot framework variable ${EXECDIR}, like this: Resource ${EXECDIR}/Sites/Resources/CST.robot

The execution of the scripts works without errors, but every line in my test cases section says "Keyword definition not found" and all are underlined with red, so I've lost the ability to use ctrl + click to navigation through the scripts.

The only way to make the red lines go away is to change the resources so that they use the full execution path: Resource C:/dev/scripts/robotfw/Sites/Resources/CST.robot

This work around isn't great because everyone on the team seems to be using a different execution path. It would be nice if we could use the global execution directory variable ${EXECDIR} that comes with robot framework.

lmc182 avatar Dec 22 '15 01:12 lmc182

+1 I think almost everyone uses a variable to point to resource location or at least to some part of that path, thus keyword navigation becomes impossible for anyone that applies this good practice.

shamaho avatar Jan 11 '16 11:01 shamaho

In case anyone is interested, I made some modifications to the plugin code to partly do what is being discussed here. More specifically, in the case of the example above, when a variable named ${RESOURCE} is encountered in a path the new code will substitute the content of a environment variable named ROBOT_RESOURCE. This is a quick fix that makes intellibot much more useful in our setup, where we have a lot of files with a few variable of the same name with the same value. So if you have lots of variables, or variables with the same name having different values in different files then this won't do much for you.

It involved changes in only one file. If someone wants it I can share the resulting jar as well as the modified source file.

aleblanc39 avatar Apr 08 '16 18:04 aleblanc39

If you want to make a pull request I would be happy to take and build off of it. I recently added some of the built in vars and I imagine that can help there too.

mtrubs avatar Apr 10 '16 17:04 mtrubs

I'll test your latest. It's likely that all the functionality I added is already there. If not then I'll make the pull request.

aleblanc39 avatar Apr 20 '16 13:04 aleblanc39

So I did add a good deal of resolution for variables. I think getting to the context though is something yet to be added. For example resource ${CUR_DIR}/a/sample.robot will still have issues because CUR_DIR has no context to /user/you/project/src (yet).

mtrubs avatar Apr 20 '16 14:04 mtrubs

How do I install this latest version ? I downloaded the ZIP file, installed the plugin but upon restarting IntelliJ 15.0.3 Coomunity Ed., I got:

"Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: com.millennialmedia.intellibot.psi.RobotPsiManager PluginClassLoader[com.millennialmedia.intellibot, 0.9.143.381] [Plugin: com.millennialmedia.intellibot]"

What am I missing ?

shamaho avatar Apr 21 '16 10:04 shamaho

The latest artifact that I have generated is the jar file in the master branch (https://github.com/millennialmedia/intellibot/raw/master/intellibot.jar). If you build it yourself you have to make sure that that python.jar is of scope provided in the module dependency settings. Then when you build the plugin you should get a jar artifact as opposed to a zip. I do not know what zip you mean otherwise.

mtrubs avatar Apr 21 '16 11:04 mtrubs

Same issue here. We defined the same keywords in different PO models for different targets and have a variable for pointing to the right resource directory. So we could really use the support for variables in resource path.

(I tried the master jar build, it does not support it).

I would do the PR if that can help, but I have no idea where to start.

(I use it in PyCharm 2016.1.4, if that's of any use)

smaspe avatar Jul 29 '16 16:07 smaspe

Is there any current workaround for this addition?

mtaylorSF avatar Jan 05 '17 18:01 mtaylorSF

I am having the same issues. Is there an update for this? work around or solution? Thanks

jourdanbennett avatar Mar 29 '17 14:03 jourdanbennett

+1 I'm working on a project that uses a ${root_directory} variable in all its files to provide an absolute path. When calling pybot, we use -v to define the root_directory variable. Is there any way to add variables to Intellibot like the -v for pybot?

awesomeamyg avatar May 25 '17 17:05 awesomeamyg

+1 same issue for ${EXECDIR}. Would love to see this resolved.

tracymazelin avatar May 26 '17 15:05 tracymazelin

+1

TomskDiver avatar Jun 19 '17 07:06 TomskDiver

+1

barbara-lea avatar Mar 19 '19 07:03 barbara-lea

+1

rapidroamer avatar Mar 21 '19 02:03 rapidroamer

I think I've found a workaround / solution folks @lmc182 Resources /models/google_search/HomePage.robot ##doesn't resolve Resources models/google_search/HomePage.robot ##resolves perfectly.

rapidroamer avatar Mar 21 '19 05:03 rapidroamer

I am having a similar issue...any solution for this??

cnaidu3 avatar Aug 13 '19 14:08 cnaidu3