gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 02:37:33 26 4
gpt4 key购买 nike

我正在尝试使用 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}"
}
]
}

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

最佳答案

如果您使用的是最新版本的 VS Code(我使用的是 v1.29.0),调试单元测试是内置功能。<​​/p>

enter image description here

您需要首先构建解决方案dotnet build才能显示测试运行和调试选项。

关于在 Visual Studio Code 中调试 MSTest 单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43210794/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com