How to run xUnit test DLL in Commandline without building the project

后端 未结 1 481
星月不相逢
星月不相逢 2021-01-01 18:49

I have a project in .NET Core and have built tests using xUnit. Now I wanted to run the test in deployment process. What I have done so far:

I used this command in

相关标签:
1条回答
  • 2021-01-01 19:13

    You have several options here:

    1. Use vstest command

    dotnet vstest Foo.dll
    

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

    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
    

    This bin output is necessary to run the tests.

    2. Skip the project build on test run

    dotnet test --no-build
    
    0 讨论(0)
提交回复
热议问题