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 commandline:
dotnet test [project address] ...
it is working but the problem is that this command get the .csproj
file and not the dll
.
I installed and used xunit.runner.console
but its not working with .NET Core projects.
I used dotnet xunit
command, this one also not helped while I cannot give it the dll
it is also using the project folder.
What can I use to run my built test (dont want to build them again), any commandline tools that I can give my test dll
as an input and it runs the test for me.
The dotnet test command builds the solution and runs a test host application for each test project in the solution. The test host executes tests in the given project using a test framework, for example: MSTest, NUnit, or xUnit, and reports the success or failure of each test.
The MSBuild runner in xUnit.net v2 is capable of running unit tests from both xUnit.net v1 and v2. It can run multiple assemblies at the same time, and build file options can be used to configuration the parallelism options used when running the tests.
You have several options here:
vstest
commanddotnet 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.
dotnet test --no-build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With