Debug unit tests in windows with VSCode?

How to launch de debugger for unit tests in VSCode?
My current launch.json is as follows:

    "version": "0.2.0",
    "configurations": [
            "type": "lldb",
            "request": "launch",
            "sourceLanguages": [
            "args": [],
            "cwd": "${workspaceFolder}",
            "name": "Debug Test",
            "program": "${workspaceFolder}\\.build\\x86_64-unknown-windows-msvc\\debug\\CScape2PackageTests.xctest",
            "preLaunchTask": "swift-build-test"

and I have the task.json

    "version": "2.0.0",
    "tasks": [
            "label": "swift-build-test",
            "type": "shell",
            "command": "swift build --build-tests"

Are you using the VSCode swift extension? With that you can use the Test Explorer to launch debug sessions for tests.

Yes. I tried the Text Explorer, but with no luck.


Are you using XCTest to create your tests or the new swift-testing? The VSCode extension doesn’t have support for swift-testing.

I'm using XCTest.
But as the error message points out, its looking for an .xctest.exe that doesn't exists at the debug folder.
Also, it is missing a part of the path. It should be .build\x86_64-unknown-windows-msvc\debug
But maybe it's my toolchain. I'm using the one from The Browser Company

It should create a symbolic link debug to the last built debug build. Do you want to add an issue in the vscode extension GitHub repo GitHub - swift-server/vscode-swift: Visual Studio Code Extension for Swift and we can try and work out the issue there.

Please check if you followed this step before installing the toolchain. It’s a common issue which I’ve seen a ton of reports on the forums.

I have Visual Studio 2022 installed. I'm also able to run and debug swift executables thru VSCode.
My only issue is with unit tests.

All the issues were solved by enabling symbolic link.