如何在Visual Studio Code中运行所有测试 [英] How to run all tests in Visual Studio Code
本文介绍了如何在Visual Studio Code中运行所有测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最新版本的VS Code已经提供了一种简单的方法来运行单个测试,如
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:
- Install the .NET Core Test Explorer extension
- Open a .NET Core test project in VS Code, or set
dotnet-test-explorer.testProjectPath
to the folder path of .NET Core test project insettings.json
- In .NET Test Explorer of Explorer view, all the tests will be automatically detected, and you are able to run all tests or a certain test
这篇关于如何在Visual Studio Code中运行所有测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文