NUnit与MbUnit与MSTest与xUnit.net

编程入门 行业动态 更新时间:2024-10-25 22:29:39
本文介绍了NUnit与MbUnit与MSTest与xUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: 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样式的关注/上下文/观察规范,如此处.

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属性和相应的数据属性直接支持即装即用型测试.合适的输入数据可以从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实现...可能性是无限的.结合另一个非常具有前瞻性的模拟框架 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与MbUnit与MSTest与xUnit.net

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

发布评论

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

>www.elefans.com

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