简体   繁体   English

如何在Visual Studio中的F#中发现并运行fsunit.xunit测试?

[英]How do I discover and run fsunit.xunit tests in F# in Visual Studio?

I am new to unit testing, but I want to experiment with xunit in F# (in a fresh VS2015 install). 我是单元测试的新手,但我想在F#中尝试使用xunit(在新的VS2015安装中)。 I created a new library, ran: 我创建了一个新的库,运行:

Install-Package fsunit.xunit

... and I can create a test: ......我可以创建一个测试:

[<Fact>]
let test () = "Yay"

, but when I right-click and do "Run Tests", it doesn't find my test. ,但是当我右键单击并执行“运行测试”时,它找不到我的测试。

When I search the extensions, there's a "xUnit.net runner for Visual Studio" in the online search results, but it says "NO LONGER NEEDED. Please un-install this extension." 当我搜索扩展时,在线搜索结果中有一个“用于Visual Studio的xUnit.net运行器”,但它表示“不再需要。请取消安装此扩展程序”。 So I don't want to install that. 所以我不想安装它。

What am I missing, to enable the tests to be discovered and run? 我缺少什么,以便能够发现和运行测试?

I needed to install both the FSunit package and this test runner: 我需要安装FSunit包和这个测试运行器:

Install-Package fsunit.xunit -prerelease
Install-Package xunit.runner.visualstudio

(The current released version does not support the latest version of xunit, hence -prerelease.) (当前发布的版本不支持最新版本的xunit,因此--prelease。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM