且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不构建项目的情况下在命令行中运行xUnit测试DLL

更新时间:2023-08-23 11:54:40

您在这里有几种选择:

dotnet vstest Foo.dll

dll 运行测试。支持xUnit测试。 文档

to run tests from a dll. xUnit tests are supported. Documentation.

仅一个 dll 文件是不够的。从 bin 文件夹运行 dotnet vstest ,该文件夹通常包含:

A single dll file only is not enough. Run dotnet vstest from your bin folder, which usually contains:

Foo.dll
Foo.deps.json
Foo.runtimeconfig.json
Foo.runtimeconfig.dev.json
Microsoft.Extensions.Logging.Test.dll
xunit.runner.reporters.netstandard15.dll
xunit.runner.utility.netstandard15.dll
xunit.runner.visualstudio.dotnetcore.testadapter.dll

bin 输出对于运行测试是必需的。

This bin output is necessary to run the tests.

dotnet test --no-build