最新版本的VS Code已经提供了一种简单的方法来运行单个测试,如Tyler Long的回答中指出的那样,他回答了一个关于在.NET Core和Visual Studio Code中调试xunit测试的问题。
然而,我正在寻找如何在VS Code中运行包含在测试套件类中的所有测试(不使用调试)?
我唯一找到的方法是向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"
}
"dotnet-test-explorer.testProjectPath": "**/*Tests" }```
- 3ehrang