本文介绍了如何在F#中处理单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在F#中创建单元测试?我通常将Visual Studio的UnitTest部分与[TestClass]和[TestMethod]属性一起使用,并使用测试视图"来运行它们.我知道我可以创建一个脚本文件并运行它们,但是我喜欢它当前的处理方式.

How do you create unit tests in F#? I typically use the UnitTest portion of Visual Studio with a [TestClass] and [TestMethod] attributes and use the Test View to run these. I know I can just create a script file and run these, but I like the way that it is currently handled.

推荐答案

我宁愿使用 FsUnit FsTest 来用F#编写测试,感觉比OO xUnit 样式测试.

I'd rather use FsUnit or FsTest to write tests in F#, it feels more natural than OO xUnit style tests.

EDIT 2014 :我现在认为FsUnit/FsTest主要是无用的语法糖. 比OO更自然"并不意味着任何东西.几个月前,我在此处 a>(我建议阅读整个线程).

EDIT 2014: I now consider FsUnit/FsTest to be mostly useless syntax sugar. And "more natural than OO" doesn't mean absolutely anything. A few months ago I wrote my current thoughts on testing here (I recommend reading the entire thread).

这篇关于如何在F#中处理单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!