The latest version of VS Code already provides an easy way of running a single test as pointed on Tyler Long's answer to the question Debugging xunit tests in .NET Core and Visual Studio Code.
However, I am looking how can I run all tests contained in a test suite class in VS Code (without debug)?
The only way I found was adding to launch.json
a specific configuration as the following one, but which I can only run in debug (I would like to run it without debug):
{
"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"
}
There is a much easier way to run all tests:
dotnet-test-explorer.testProjectPath
to the folder path of .NET Core test project in settings.json