Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running xunit from console

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
like image 553
Raif Avatar asked Jan 09 '14 18:01

Raif


People also ask

Where is xUnit console exe?

In the tools folder of the console runner package folder, you will find xunit. console.exe .

How do I run xUnit from command line?

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.


2 Answers

Way to find xUnitConsole.exe Search the package in

%userprofile%\.nuget\packages

.nuget\packages\xunit.runner.console->Your Version installed->Tools->xUnitConsole.exe

like image 156
Ujjwal Roy Avatar answered Oct 20 '22 15:10

Ujjwal Roy


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.

like image 40
Josh Gallagher Avatar answered Oct 20 '22 15:10

Josh Gallagher