相关疑难解决方法(0)

如何在 VS Code 中调试 dotnet 测试?

本文介绍如何设置 VS Code 设置以将调试目标指向单元测试项目的构建输出。因此,我将我的设置如下:

{
    "explorer.confirmDragAndDrop": false,
    "git.allowForcePush": true,
    "git.autofetch": true,
    "window.zoomLevel": 0,
    "csharp.unitTestDebuggingOptions": {
        "sourceFileMap": {
            "C:\\git\\MsTester\\bin\\Debug\\netcoreapp2.1": "C:\\git\\MsTester\\bin\\Debug\\netcoreapp2.1"
        }
    },
    "files.autoSave": "afterDelay",
    "files.exclude": {
        "**/bin": true,
        "**/node_modules": true,
        "**/obj": true
    },
    "csharpfixformat.style.spaces.insideEmptyBraces": false,
    "csharpfixformat.style.braces.allowInlines": false,
    "csharpfixformat.style.spaces.beforeParenthesis": false,
    "csharpfixformat.style.spaces.afterParenthesis": false,
    "csharp.format.enable": false,
    "extensions.ignoreRecommendations": true
}
Run Code Online (Sandbox Code Playgroud)

但是,我不确定如何设置launch.json以启动dotnet test它以便它可以附加调试器。

这是我目前所拥有的:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "MsTester",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/MsTester/bin/Debug/netcoreapp2.1/MsTester.dll",
            "windows": {
                "args": [
                    "--filter",
                    "TestCategory=lbshell",
                    "--logger",
                    "trx",
                    "--results-directory",
                    ".\\TestResults",
                    "--settings", …
Run Code Online (Sandbox Code Playgroud)

unit-testing vscode-settings dotnet-test vscode-debugger

12
推荐指数
2
解决办法
7132
查看次数

在 Visual Studio Code 中调试 MSTest 单元测试

我正在尝试使用 Visual Studio Code 调试 MSTest 单元测试项目。但测试只是运行,断点从未达到。

这是我的launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Test (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "C:\\Program Files\\dotnet\\dotnet.exe",
            "args": ["test"],
            "cwd": "${workspaceRoot}",
            "console": "internalConsole",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart"
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

如何调试单元测试 (MSTest)?XUnit 也存在同样的问题。

debugging mstest .net-core visual-studio-code

6
推荐指数
2
解决办法
5404
查看次数

如何在VSCode中调试测试.Net Core 2.0

我正在寻找一种在VSCode中调试测试(mstest).Net Core 2.0的方法?

我什么也没找到。

谢谢!

.net-core visual-studio-code dotnet-test

5
推荐指数
2
解决办法
669
查看次数