Run with debug robot framework in VS Code

Hi,
I’m working with VS code version 1.85.0 (user setup)
How can I add the ability to debug robot framework tests (that running also python scripts) from VS code.
I know that there is an option to display the ‘debug’ line above each test case.
How can I add it?
I have the ‘robocorp code’ and ‘robot framework language’ extensions
in the settings of the ‘robot framework language’ I updated the path of the python in the fields: Robot › Language-server: Python and Robot › Python: Executable and it didn’t help

If you use Daniel’s RobotCode extension (disable any other language servers for Robot Framework), you can add a debug config from the Debugging tab by choosing “Add configuration” from the dropdown next to RUN AND DEBUG at the top of the Debug view. After doing that, you should get green “run” arrows in your test suites and your Testing view should populate with available suites.

Thanks,
I did it and I have the green run. But if I add a breakpoint in the python file (that the robot test call it) and run the test with debug, the run doesn’t stop where the breakpoint is.

By default debugging python is disabled.
Search for the setting robotcode.debug.attachPython in the VSCode settings and switch it on.

Hi,
I’m experiencing the same problem that debugging a robot test with RobotCode doesn’t stop for a breakpoint within a python file. The setting robotcode.debug.attachPython is already configured within my settings.json.

I’m using the versions:
VSCode: 1.92.2
RobotCode extension: v0.99.0
Python extension: v2024.14.1
RF: 6.1.1

With Robocorp’s RF Language Server the breakpoints have worked well, but I would like to get this working with RobotCode.

Hi,

Don’t know if there were more infos from Daniel somewhere, but I can confirm you it works by setting the launch.json file as below:

In this case the test doesn’t pass over the .py script and enters in it to stop on the setted breakpoint.

Regards.
Charlie

Thanks for the hint Charlie!
Seems like it’s working, but only for custom libraries - not for the Browser or JSONLibrary.

You don’t need the launch.json just delete it.

Instead of the the lauch.json open the VSCode settings, at the top of the setting switch to the “Workspace” (or “Folder” if you have folders there) and search for the following settings:

robotcode.debug.attachPython switch this on
debugpy.debugJustMyCode switch this off

your settings.json of your project should now have to entries like this:

{
    "debugpy.debugJustMyCode": false,
    "robotcode.debug.attachPython": true
}
1 Like

Setting debugpy.debugJustMyCode to false resolved my issue - great!
Thank you very much, Daniel.