nokia / RED

RED - Robot Editor
Other
339 stars 112 forks source link

How can I configure the working directory for a test execution? #438

Closed marcosanchotene closed 2 years ago

marcosanchotene commented 2 years ago

I am working on a project that has many resources and libraries imported with the ${EXECDIR} variable on their path. For them to work, test executions must start inside a particular directory within the project. I have searched a lot but could not find a way to configure the working directory for RED test executions. Is that possible?

michalanglart commented 2 years ago

Hi,

If I understand correctly you should try to use the preference: Pass selected suite as data source from here: image

When enabled RED will use the exact directory inside the project when trying to run it as a suite.

marcosanchotene commented 2 years ago

Thanks for your reply, but it's not that.

The file structure I have is more or less this:

I need to run the tests inside directory1 so the imports will work with the ${EXECDIR} variable because they are like ${EXECDIR}/resources.

If I run them in project, the imports won't work. If I run them inside tests, they won't work also.

So what I need is a way to configure the working directory of the test execution, like there is for Java applications as explained here.

michalanglart commented 2 years ago

Alright, then it was planned to make it configurable but it is not unfortunately as of now. The exact responsible line is this:

https://github.com/nokia/RED/blob/73de778620af027870d53039d0e326bb3f47cde0/src/Eclipse-IDE/org.robotframework.ide.eclipse.main.plugin/src/org/robotframework/ide/eclipse/main/plugin/launch/local/RobotLaunchConfigurationDelegate.java#L159

Which takes exactly the project location as working directory for launched process:

robotProject.getProject().getLocation().toFile()
marcosanchotene commented 2 years ago

Ok. Thanks for clarifying it. I guess my only option is to refactor the imports.