AmailP / robot-plugin

Robot Framework support plugin for IntelliJ Idea
Other
72 stars 38 forks source link

Add functionality to resolve ${CURDIR} and ${EXECDIR} #5

Open pchomik opened 10 years ago

pchomik commented 10 years ago

Resources are not working if path contains ${CURDIR} or ${EXECDIR}. Is it possible to add functionality to try resolve these variables or get some configuration panel to set. With ${CURDIR} should be difficult, ${EXECDIR} could be root folder in the project or configured somewhere statically.

AmailP commented 10 years ago

The ${CURDIR} should be easy to implement. But please could you please explain me why is this variable needed for resources? All the paths that you specify for resources are always resoved from the current directory, even if you don't specify it.

AmailP commented 10 years ago

For the ${EXECDIR} the question is different... I would like to support it when there will be support for Robot run configuration.

pchomik commented 10 years ago

Regarding ${CURDIR}: you are right. I missed that fact. Regarding ${EXECDIR}: What do you mean by "Robot run configuration"?

AmailP commented 10 years ago

The goal would be to be able to execute .robot files directly from the IDE, like you can do with JUnit tests. This would require to develop a specific Robot framework run configuration (look in Run -> Edit Configurations...)

joelwhitehouse commented 7 years ago

The ${CURDIR} feature would be much appreciated. I initially included it at the recommendation of some discussions in the RobotFramework community, but reverted to using "./" because the Robot Framework Plugin for Pycharm could not resolve it, and it was frustrating to lose autocomplete functionality. I'd be grateful if the plugin would support this recommended variable.

barbara-lea commented 5 years ago

The ${EXECDIR} configurable somewhere static for the ide would be very useful. Recently I changed the paths to my resources where I had to write long relative paths, for example, I changed '../../../resources/LoginPage.resource' to '{EXECDIR}/resources/pages'. This way the paths are less fragile to changes. But the editor does not know about the path and I lose a lot of features, like going to keyword definition or auto-completion.

yzerk commented 5 years ago

@AmailP Imagine you have this folder structure: example-project ├───resources │ ├───resource1 │ │ ├───subresourcefolder1 │ │ └───subresourcefolder2 │ │ ├───resource-file1.robot │ └───resource2 │ ├───resource-file2.robot ├───test-suites │ ├───suite1 │ │ ├───test-file1.robot │ ├───suite2 │ ├───subsuite2 │ ├───test-file2.robot

Example with ./ test-file1.robot: Settings Documentation Test-Suite some functionality Resource ./../../resources/resource1/subresourcefolder1/subresourcefolder2/resource-file1.robot Resource ./../../resources/resource2/resource-file2.robot

a) when we move resource-file1.robot to resource2 folder then we should update path in test-file1.robot to new one. b) when we move test-file1.robot to subsuite2 then we also should update path.

Example with ${CURDIR} looks like the same as with ./

Example with ${EXECDIR} test-file1.robot: Settings Documentation Test-Suite some functionality Resource ${EXECDIR}/resources/resource1/subresourcefolder1/subresourcefolder2/resource-file1.robot Resource ${EXECDIR}/resources/resource2/resource-file2.robot

a) when we move resource-file1.robot to resource2 folder then we should update path in test-file1.robot to new one. b) we don't need to update path to resources in test files, when we move it to another subfolder.

In addition when we have multiple test files which refers to the same resource file and we need to change resource file location, we can just simply make fast replace old location to new location. And the path will be valid for all test files in different folders and subfolders

Also it could be the foundation for further plugin update about automation path update if you would like to implement it.

So, in case when we use ${CURDIR} or ./, we should always take care about relative paths of two files unlike ${EXECDIR}

BTW, I could not see any restrictions with run configuration with ${EXECDIR}

f4610 commented 4 years ago

@barbara-lea I've got the same issue as yours "But the editor does not know about the path and I lose a lot of features, like going to keyword definition or auto-completion." using pycharm. I've switched to visual studio code and it recognize the given keywords.