如何在 F# 中处理单元测试? [英] How to handle unit tests in F#?

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

问题描述

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

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# 中处理单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆