问题
I am trying to run xUnit tests (from an F# module, if it makes any difference) using TestDriven.NET, but whatever I do I get this error:
It looks like you're trying to execute an xUnit.net unit test.
For xUnit 1.5 or above (recommended):
Please ensure that the directory containing your 'xunit.dll' reference also contains xUnit's
test runner files ('xunit.dll.tdnet', 'xunit.runner.tdnet.dll' etc.)
For earlier versions:
You need to install support for TestDriven.Net using xUnit's 'xunit.installer.exe' application.
You can find xUnit.net downloads and support here:
http://www.codeplex.com/xunit
I tried following the suggestions, i.e. I copied the files
xunit.dll.tdnet
xunit.extensions.dll
xunit.gui.clr4.exe
xunit.runner.tdnet.dll
xunit.runner.utility.dll
xunit.runner.utility.xml
xunit.xml
to the folder with xunit.dll and I ran xunit.installer.exe
. How can I get it to work?
回答1:
I just figured out that I forgot to make the test a function in F# (so it was just a value). The error message can't be more misleading though!
回答2:
You have two problems:
your Fact is broken:-
If you hover over the
please work
bit, you'll see something like:
unit -> int
For a
Fact
to be picked up by an xUnit runner, it needs to yield `unit (void).Hence, one key thing to get right first is to not return anything. In other words, replace your
123
with()
(or an Assertion).You can guard against this by putting a
:unit
stipulation on the test:-[<Fact>] let ``please work`` () : unit = 123
This will force a compilation error.
TestDriven.NET is reporting it cannot find the xunit.tdnet modules
It's critical to get step 1 right first. Then retry and the problem should be gone
If it remains...
Either try the VS-based runner which should work as long as it's installed and xunit.dll is getting to your output dir or look at the docs for your version of TD.NET for detailed troubleshooting notes (exec summary is if the .tdnet file was in your out dir or you undo and redo the xunit.installer from the folder containing the packages it should just work, esp if you are on latest)
来源:https://stackoverflow.com/questions/11030404/running-f-xunit-fact-from-testdriven-net-reporting-it-looks-like-youre-trying