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"
}