# Debugger doesn't stop at breakpoints when running tests (but does during normal execution)

**URL:** <https://discourse.julialang.org/t/debugger-doesnt-stop-at-breakpoints-when-running-tests-but-does-during-normal-execution/93202>\
**Category:** VS Code\
**Tags:** testing, debugging, vscode\
**Created:** [January 19, 2023, 9:14am UTC](https://discourse.julialang.org/t/debugger-doesnt-stop-at-breakpoints-when-running-tests-but-does-during-normal-execution/93202 "2023-01-19T09:14:15Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![eott-siz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eott-siz/32/44936_2.png) [@eott-siz](https://discourse.julialang.org/u/eott-siz)\
**Post date:** [March 8, 2023, 12:48pm UTC](https://discourse.julialang.org/t/debugger-doesnt-stop-at-breakpoints-when-running-tests-but-does-during-normal-execution/93202/9 "2023-03-08T12:48:39Z")

</div>

An (hopefully final) update to the original question of how to debug tests with the debugging functionality within the VS Code plugin for Julia:

First, as described in the previous post, let’s modify our tests so that the code lives within functions.

`included_tests.jl`

```julia
using Test
using PackageToTest.ModuleToTest

function test_do_something()
    @test ModuleToTest.do_something(41) == 42
end

@testset "test_do_something" begin
    test_do_something()
end

function test_internal_only()
    @test ModuleToTest.internal_only(41) == 42
end

@testset "test_internal_only" begin
    test_internal_only()
end

```

and we need a debug launch config that runs the active file (I think this is the default config):

`launch.jl`

```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "julia",
            "request": "launch",
            "name": "Run active file",
            "program": "${file}",
            "stopOnEntry": false,
            "cwd": "projectdir/",
            "juliaEnv": "${command:activeJuliaEnvironment}",
            "args": []
        },
    ]
}

```

Now we can open file `included_tests.jl`, hit F5 and the debugger will stop at breakpoints in file `ModuleToTest.jl` and display the values of variables in the debug pane, as well as allowing for the stepping functions to work as expected.

---

_[View the full topic](https://discourse.julialang.org/t/debugger-doesnt-stop-at-breakpoints-when-running-tests-but-does-during-normal-execution/93202)._
