# Run with debug robot framework in VS Code

**URL:** <https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555>\
**Category:** Visual Studio Code(ium)\
**Created:** [11 December 2023 12:21 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555 "2023-12-11T12:21:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![GalManz](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@GalManz](https://forum.robotframework.org/u/GalManz)\
**Post date:** [11 December 2023 12:21 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/1 "2023-12-11T12:21:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robinmackaij](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/robinmackaij/32/126_2.png) [@robinmackaij](https://forum.robotframework.org/u/robinmackaij)\
**Post date:** [11 December 2023 17:58 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/2 "2023-12-11T17:58:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GalManz](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@GalManz](https://forum.robotframework.org/u/GalManz)\
**Post date:** [12 December 2023 07:55 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/3 "2023-12-12T07:55:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![daniel](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/daniel/32/1492_2.png) [@daniel](https://forum.robotframework.org/u/daniel)\
**Post date:** [12 December 2023 13:28 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/4 "2023-12-12T13:28:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Weinzierleiner](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/weinzierleiner/32/4678_2.png) [@Weinzierleiner](https://forum.robotframework.org/u/Weinzierleiner)\
**Post date:** [22 November 2024 07:27 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/5 "2024-11-22T07:27:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [22 November 2024 17:09 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/6 "2024-11-22T17:09:08Z")

</div>

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:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/6/6eeee063e199f2a2fc4e5b9a09e96df7cbe5a398.png)

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

Regards.  
Charlie

---

<div class="post-metadata">

**Author:** ![Weinzierleiner](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/weinzierleiner/32/4678_2.png) [@Weinzierleiner](https://forum.robotframework.org/u/Weinzierleiner)\
**Post date:** [25 November 2024 07:16 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/7 "2024-11-25T07:16:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daniel](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/daniel/32/1492_2.png) [@daniel](https://forum.robotframework.org/u/daniel)\
**Post date:** [26 November 2024 10:41 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/8 "2024-11-26T10:41:25Z")

</div>

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:

```jsonc
{
    "debugpy.debugJustMyCode": false,
    "robotcode.debug.attachPython": true
}

```

---

<div class="post-metadata">

**Author:** ![Weinzierleiner](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/weinzierleiner/32/4678_2.png) [@Weinzierleiner](https://forum.robotframework.org/u/Weinzierleiner)\
**Post date:** [26 November 2024 12:38 UTC](https://forum.robotframework.org/t/run-with-debug-robot-framework-in-vs-code/6555/9 "2024-11-26T12:38:05Z")

</div>

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