NUnit vs. MbUnit vs. MSTest vs. xUnit.net [英] NUnit vs. MbUnit vs. MSTest vs. xUnit.net

查看:33
本文介绍了NUnit vs. MbUnit vs. MSTest vs. xUnit.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多用于 .NET 的单元测试框架.我发现了这个小功能比较:http://xunit.github.io/docs/comparisons.html

There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: http://xunit.github.io/docs/comparisons.html

现在我要为我们选择最好的.但是如何?有关系吗?哪一个最有未来证明并且背后有不错的势头?我应该关心这些功能吗?虽然 xUnit 似乎是最现代的,并且是专为 .NET 设计的,但 NUnit 似乎再次被广泛接受.MSTest 再次集成到 Visual Studio 中...

Now I am to choose the best one for us. But how? Does it matter? Which one is most future proof and has a decent momentum behind it? Should I care about the features? While xUnit seems to be most modern and specifically designed for .NET, NUnit again seems to be the one that is widely accepted. MSTest again is already integrated into Visual Studio ...

推荐答案

我知道这是一个旧线程,但我想我会为 xUnit.NET.虽然提到的大多数其他测试框架都几乎相同,但 xUnit.NET 采取了一种非常独特、现代且灵活的单元测试方法.它改变了术语,因此您不再定义 TestFixtures 和 Tests……您指定有关代码的事实和理论,这从 TDD/BDD 的角度更好地与测试的概念相结合.

I know this is an old thread, but I thought I'd post a vote for xUnit.NET. While most of the other testing frameworks mentioned are all pretty much the same, xUnit.NET has taken a pretty unique, modern, and flexible approach to unit testing. It changes terminology, so you no longer define TestFixtures and Tests...you specify Facts and Theories about your code, which integrates better with the concept of what a test is from a TDD/BDD perspective.

xUnit.NET 也是非常可扩展的.它的 FactAttribute 和 TraitAttribute 属性类不是密封的,并提供可覆盖的基本方法,使您可以对如何执行这些属性修饰的方法进行大量控制.虽然默认形式的 xUnit.NET 允许您编写与 NUnit 测试装置及其测试方法类似的测试类,但您完全不限于这种形式的单元测试.您可以自由扩展框架以支持 BDD 风格的 Concern/Context/Observation 规范,如图 此处.

xUnit.NET is also EXTREMELY extensible. Its FactAttribute and TraitAttribute attribute classes are not sealed, and provide overridable base methods that give you a lot of control over how the methods those attributes decorate should be executed. While xUnit.NET in its default form allows you to write test classes that are similar to NUnit test fixtures with their test methods, you are not confined to this form of unit testing at all. You are free to extend the framework to support BDD-style Concern/Context/Observation specifications, as depicted here.

xUnit.NET 还通过其 Theory 属性和相应的 data 属性直接支持开箱即用的适合风格测试.Fit 输入数据可以从 excel、数据库甚至自定义数据源(如 Word 文档)加载(通过扩展基本数据属性).这允许您利用单个测试平台进行单元测试和集成测试,可以极大地减少产品依赖性和所需的培训.

xUnit.NET also supports fit-style testing directly out of the box with its Theory attribute and corresponding data attributes. Fit input data may be loaded from excel, database, or even a custom data source such as a Word document (by extending the base data attribute.) This allows you to capitalize on a single testing platform for both unit tests and integration tests, which can be huge in reducing product dependencies and required training.

其他测试方法也可以用 xUnit.NET 实现……可能性是无限的.结合另一个非常具有前瞻性的 mocking 框架 Moq,两者创建了一个非常灵活、可扩展和强大的平台用于实施自动化测试.

Other approaches to testing may also be implemented with xUnit.NET...the possibilities are pretty limitless. Combined with another very forward looking mocking framework, Moq, the two create a very flexible, extensible, and powerful platform for implementing automated testing.

这篇关于NUnit vs. MbUnit vs. MSTest vs. xUnit.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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