【问题标题】:Running F# xUnit Fact from TestDriven.NET reporting "It looks like you're trying to execute an xUnit.net unit test."从 TestDriven.NET 运行 F# xUnit Fact 报告“看起来您正在尝试执行 xUnit.net 单元测试。”
【发布时间】:2012-06-14 09:38:07
【问题描述】:

我正在尝试使用 TestDriven.NET 运行 xUnit 测试(从 F# 模块,如果它有任何区别的话),但无论我做什么我都会得到这个错误:

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

我尝试按照建议进行操作,即我复制了文件

xunit.dll.tdnet
xunit.extensions.dll
xunit.gui.clr4.exe
xunit.runner.tdnet.dll
xunit.runner.utility.dll
xunit.runner.utility.xml
xunit.xml

到带有 xunit.dll 的文件夹,然后我运行 xunit.installer.exe。我怎样才能让它工作?

【问题讨论】:

标签: f# testdriven.net xunit.net


【解决方案1】:

我刚刚发现我忘记在 F# 中将测试设为函数(所以它只是一个值)。不过,错误信息不能再误导了!

【讨论】:

【解决方案2】:

你有两个问题:

  1. 你的事实被打破了:-

    如果你将鼠标悬停在

    please work

    bit,你会看到类似:unit -> int

    对于要被 xUnit 跑步者拾取的 Fact,它需要产生 `unit (void)。

    因此,首先要做好的一个关键是不返回任何东西。换句话说,用()(或断言)替换你的123。

    您可以通过在测试中添加:unit 规定来防止这种情况:-

    [<Fact>]
    let ``please work`` () : unit = 123
    

    这将导致编译错误。

  2. TestDriven.NET 报告找不到 xunit.tdnet 模块

    首先正确完成第 1 步至关重要。然后重试,问题应该就解决了

    如果它仍然存在......

    要么尝试基于 VS 的运行程序,只要它已安装并且 xunit.dll 进入您的输出目录,该运行程序就可以工作,或者查看您的 TD.NET 版本的文档以获取详细的故障排除说明(执行摘要是.tdnet 文件在您的输出目录中,或者您从包含它应该可以工作的软件包的文件夹中撤消并重做 xunit.installer,尤其是如果您是最新版本)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-13
    • 2011-04-04
    相关资源
    最近更新 更多