NUnit vs. MbUnit vs. MSTest vs. xUnit.net [关闭](NUnit vs. MbUnit vs. MSTest vs. xUnit.net [closed])

编程入门 行业动态 更新时间:2024-10-24 05:18:48
NUnit vs. MbUnit vs. MSTest vs. xUnit.net [关闭](NUnit vs. MbUnit vs. MSTest vs. xUnit.net [closed])

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

现在我要为我们选择最好的一个。 但是怎么样 有关系吗? 哪一个是最有前途的证据,背后有一个体面的动力? 我应该关心功能吗? 虽然xUnit似乎是最现代化的,专门为.NET设计,但NUnit似乎也被广泛接受。 MSTest再次已经集成到Visual Studio ...

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

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角度来看测试的概念。

xUnit.NET也是极其可扩展的。 它的FactAttribute和TraitAttribute属性类没有被封装,并且提供了可以覆盖的基本方法,这些方法可以很好地控制这些属性所装饰的方法应如何执行。 虽然xUnit.NET的默认形式允许您使用测试方法编写类似于NUnit测试夹具的测试类,但您并不局限于这种单元测试形式。 您可以自由扩展框架以支持BDD风格的关注/上下文/观察规范,如此处所示。

xUnit.NET还支持使用其Theory属性和相应的数据属性直接开箱即用的fit-style测试。 适合的输入数据可以从excel,数据库甚至自定义数据源(如Word文档)(通过扩展基本数据属性)加载。这样可以利用单个测试平台进行单元测试和集成测试,可以大大减少产品依赖性和必要的培训。

测试的其他方法也可以用xUnit.NET来实现...可能性是非常无限的。 结合另一个非常前瞻性的模拟框架, Moq ,这两个框架为实现自动化测试创建了一个非常灵活,可扩展和强大的平台。

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 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 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.

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.

更多推荐

本文发布于:2023-07-04 11:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023598.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MSTest   MbUnit   NUnit   closed   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!