Running F# xUnit Fact from TestDriven.NET reporting “It looks like you're trying to execute an xUnit.net unit test.”

StackOverflow https://stackoverflow.com/questions/11030404

  •  14-06-2021
  •  | 
  •  

Frage

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?

War es hilfreich?

Lösung

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!

Andere Tipps

You have two problems:

  1. 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.

  2. 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)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top