robot-plugin icon indicating copy to clipboard operation
robot-plugin copied to clipboard

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

Open pchomik opened this issue 10 years ago • 8 comments

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.

pchomik avatar May 08 '14 11:05 pchomik

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 avatar May 08 '14 19:05 AmailP

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

AmailP avatar May 08 '14 19:05 AmailP

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

pchomik avatar May 09 '14 06:05 pchomik

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...)

AmailP avatar May 09 '14 06:05 AmailP

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.

joelwhitehouse avatar Aug 01 '17 04:08 joelwhitehouse

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.

barbara-lea avatar Mar 22 '19 11:03 barbara-lea

@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}

yzerk avatar Jun 07 '19 15:06 yzerk

@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.

f4610 avatar Dec 23 '19 20:12 f4610