且构网

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

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

更新时间:2023-08-23 12:12:58

这里有几个选项:

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