How to run test DLL xUnit on command line without creating project

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

I used this command on the command line:

dotnet test [project address]  ... 

      

it works, but the problem is that this command gets the file .csproj

and not dll

.

I've installed and used xunit.runner.console

but didn't work with .NET Core projects.

I used a command dotnet xunit

, this one didn't help either, until I can give it dll

, it uses the project folder as well.

What can I use to run my inline test (don't want to create them again), any command line tools I can give my test dll

as input and it runs the test for me.

+8


source to share


1 answer


You have several options here:

1. Use the command vstest

dotnet vstest Foo.dll

      

run tests from dll

. XUnit tests are supported. Documentation

One file alone is dll

not enough. Run dotnet vstest

from a folder bin

that 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 output is bin

required to run tests.

2. Skip project build during test run

dotnet test --no-build

      

+13


source







All Articles