Set outputdir in vscode workspace

Hi,

I want to specify my Report Directory in Workspace Json (Robot.code-workspace) file like the following:

{

    "folders": [

        {

            "path": "test"

        },

        {

            "path": "librenode"

        }

    ],

    "settings": {},

    "launch": {

    "version": "0.2.0",

    "configurations": [

        {

            "type": "robotframework-lsp",

            "name": "Robot Framework: Launch template",

            "request": "launch",

            "cwd": "^\"\\${workspaceFolder}\"",

            "target": "^\"\\${file}\"",

            "terminal": "integrated",

            "env": {},

            "args": ["--outputdir C:/renode/renode_1_12_x/PLT2010V1_V3/test/07_Results"]

            }

        ]

    }

}

When I run the Test I get the following error message:

[ ERROR ] option --outputdir c:/renode/renode_1_12_x/plt2010v1_v3/test/07_results not recognized

Try --help for usage information.

Can anyone tell what is the reason?

Thank you

You need to set arguments as a list of arguments, so, the arguments should be something as:

"args": ["--outputdir", "C:/renode/renode_1_12_x/PLT2010V1_V3/test/07_Results"]

i.e.: notice that there are 2 strings there instead of one with 2 arguments…

Thanks, don’t know why I haven’t tried this… :sweat_smile:

When I launch a test from VS Code (/w RF Language Server extension), output files are stored to project root. How do I change the outputdir, didn’t find any setting to control this?

Not that pretty solution, but outputdir can be set by modifying file:

C:\Users\[user]\.vscode\extensions\robocorp.robotframework-lsp-x.x.x\src\robotframework_debug_adapter\run_robot__main__.py:

=>

robot_args = [
“–listener=robotframework_debug_adapter.listeners.DebugListener”,
“–listener=robotframework_debug_adapter.listeners.DebugListenerV2”,
“–outputdir=C:/Temp/RobotLogs”,
]

1 Like

Using the Robot Framework Language Server extension, you can set command line arguments for robot in a vscode launch.json file to change where the report, log, and outputs of your test run live.

In my example below, it’s the -d argument, and it redirects the MyExecutionFolderHere/tests/robot/reports/.

Note that for some reason, if you put a space between -d and your folder path, that space is included in the folder path, which is bad. Also, note that the folder path you specify will be relative to your execution directory. And for some reason the long version of the argument, --outputdir doesn’t seem to work…

(Robot Framework Language Server v1.12.1 prerelease, Python 3.10.12, Robot Framework 7.1, Running on Windows Subsystem for Linux)

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "robotframework-lsp",
      
      // This name is required by the robot framework extension for some reason https://github.com/robocorp/robotframework-lsp/issues/1074#issuecomment-2288951860
      "name": "Robot Framework: Launch Template",
      "request": "launch",
      "cwd": "^\"\\${workspaceFolder}\"",
      "target": "^\"\\${file}\"",
      "terminal": "integrated",
      "env": {},
      "args": [
        "-dtests/robot/reports/",
      ]
    }
  ]
}