VS代碼的最新版本已經提供了運行單個測試的簡單方法,如Tyler Long's answer指向Debugging xunit tests in .NET Core and Visual Studio Code的問題。如何在Visual Studio代碼中運行所有測試代碼
但是,我正在尋找如何運行包含在VS代碼中的測試套件類中的所有測試?
我發現這是增加launch.json
具體配置如下一個唯一的辦法,但我只能在調試運行(我想沒有調試運行):
{
"name": ".NET Core Xunit tests",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "/usr/local/share/dotnet/dotnet",
"args": ["test"],
"cwd": "${workspaceRoot}/test/MyProject.Tests",
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
}