I have, what is probably, a stupid question.
I'm trying to run an xunit
dll from the command prompt.
I find that I need the following dlls to be in the folder that the command prompt is in.
xUnit.Console.exe,xunit.console.exe.config,xunit.dll,xunit.runner.utility.dll
which is fine I guess but then I can't get it to run my tests.
At first I tried using a relative path to my test dll and it was not having that.
so then I put the test dll in a folder with the above dlls and ran it. Now the result is it says I"m missing a dependency for my test dll.
So then I put the xunit files in the bin folder with my test project dlls and it tells me that it can't even find the test dll that it's sitting next to.
This all seems very difficult what i want is to do this given the following structure
--src
----tools
------xUnit
--------all my xunit dlls
----projects
------MyTestProject
-------bin
---------MyTestProject.dll
lets say
c:\Src\Tools\xUnit>xunit.console ..\\..\Projects\MyTestProject\bin\MyTestProject.dll
In the tools folder of the console runner package folder, you will find xunit. console.exe .
From the command line, create a folder for your test project, change into it, and then create the project using dotnet new : $ mkdir MyFirstUnitTests $ cd MyFirstUnitTests $ dotnet new xunit The template "xUnit Test Project" was created successfully.
Way to find xUnitConsole.exe Search the package in
%userprofile%\.nuget\packages
.nuget\packages\xunit.runner.console->Your Version installed->Tools->xUnitConsole.exe
Two solutions:
1) Add C:\src\Tools\xUnit
to your PATH environment variable and run the xunit console app from a command prompt where the current directory is C:\src\projects\MyTestProject\bin
.
2) As per the first suggestion but rather then putting it in your PATH environment variable, specify the whole path (relative or absolute) to the xunit.console.exe on the command line as the executable to run.
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