.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
发布评论