问题描述
我是新来TDD,并期待在选择的单元测试我的Visual Studio 2010的解决方案。该解决方案是一个MVC3 Web应用程序,而我的尝试的使用DDD国际奥委会,资料库和工作模式单元。它还使用EF4&放大器;该POCO EF4模板。 (我试过模型大部分是从,也借用设计模式一对夫妇的其他博客)。
我一直在寻找和阅读关于这些的几个小时,看来我发现到处都是相互矛盾的信息我转。这在很大程度上是由于旧的结果来了,和不断发展的选项,Visual Studio 2010中
我知道有几个选项,但同样,我有一个很难挑剔,从较新的选项过时的选择,并且在人用引用一些模糊性。即使在这里href=\"http://stackoverflow.com/questions/261139/nunit-vs-mbunit-vs-mstest-vs-xunit-net\">流行的讨论在
例如:
-
有之间的差异,的和
Microsoft.VisualStudio.TestTools.UnitTesting
?如果有,是什么?看来这些都是不同的,但在一些讨论,我见过被错误引用。 -
由于NUnit的笔者也创作的xUnit,这是否意味着取代的xUnit NUnit的,从而使NUnit的德precated?这似乎有些,即使在今天,preFER NUnit的。但是,如果NUnit的是德precated,为什么有人今天就开始使用NUnit过的xUnit?如果NUnit的不德precated,这是否意味着的xUnit没有起飞喜欢它本来是打算?为什么笔者继续支持两个看似多余的工具?
-
以下哪集成到Visual Studio 2010,而不必求助于独立执行的命令行进行测试,或必须购买的工具,如TestDriven.Net? (我有ReSharper的,但是,如果这种支持任何这些。)
-
最近是否有过任何显着的变化,以任何这些,将使这些无效的较旧的讨论?
-
有没有我应该考虑过或者除了那些我上面提到?任何其他
我不一定要找一个深入的比较(虽然你比欢迎更多提供一个,如果你愿意),但更多的是正在当前的工具向上最新共识目前用于新VS2010开发。
在从表面上看,Visual Studio的单元测试框架似乎很好地集成到Visual Studio 2010(专业版)开箱,似乎是很容易得到快速启动和运行,相对于其他一些人,甚至如果它是一个有点臃肿。但由于我是新的,我不想进入它3个月的道路,进而实现我自己画到一个角落里,只是因为它似乎更容易回升。
我也知道,这个问题可以被认为有些坏的问题,因为它是开放的,广泛的特性,但在这些不同的问题,我觉得他们都相关的,从我一般的混乱都干在暧昧和矛盾的点,我发现关于VS2010单元测试。
先谢谢了。
编辑:这是为了更近三十岁的我联系上面。这种讨论有一些好点,但很多东西(可以)已经在三年内改变,我很喜欢这个问题的较新的评价。
- 所有相同..只是confusopoly(MSTest的是亚军,框架是DLL)。我将把它作为MSTest的从现在开始。
- 请不要有太多的xUnit里程。我在NUnit的阵营牢牢地撒谎。不知道历史的..但吉姆AFAIR纽柯克甚至被微软的MSTest的发展录用。我可以肯定地回答NUnit的不pcated(甚至放慢)德$ P $。我刚刚固定它的报告后的几天内的错误。查理·普尔已经走向了一段时间(和做一个恒星的工作)。 NUnit的是最古老的(以及基于家庭的xUnit测试运行中,随着贝克苏尼特和JUnit启动)。我已经长大了吧(这么说)。它只是停留闪开,拥有几乎所有你需要一天一天发展的功能。 MSTest的提供VisualStudio的整合,但muddies与小细微偏差绊倒了我的水(并行,灯具安装必须是静态的,etc.etc)。其他人尽量延长在差异方面测试运行(其他城市术语例如在测试夹具理论),并在其中你写你的测试方法。我从来没有延长我的测试亚军;也许我还没有在那些需要IT环境的工作。
- NUnit的不整合了像MSTest的架子。但如果你有ReSharper的(你应该),其插入这个缺口。此外MSTest的AFAIK需要整个IDE(特定版本),不像NUnit的,可刚复制到文件夹和运行的副本。排序会导致你与如果你使用MSTest的免费code覆盖TFS。如果您的组织使用TFS为CI,你会发现整合不是MSTest的任何其他是更多的自定义code,我需要写。
4和5的事情是不断变化的所以很难形成一个最终的答案。
摘要:NUnit的是简单易学(将带你一天或更短的时间)和大多数文献w.r.t.的如果你知道它TDD会下降容易。我个人从来没有理由移动(例如NUnit的不做到这一点的xUnit不,我不能没有这个)。除非你在MS-CI(和自由的覆盖面和TestImpact)大,我会说下手NUnit的和您的方式工作。无银的测试亚军。结果
该工具不保证成功,这是你如何使用这些工具。选择一个,上手和适应。
心连心
I'm new to TDD, and am looking at options for unit testing my Visual Studio 2010 solution. This solution is an MVC3 web app, which I'm attempting to use DDD with IoC, repository, and unit of work patterns. It also uses EF4 & the EF4 POCO templates. (I tried to model much of it from the Microsoft N-layer App, also borrowing design patterns from a couple other blogs).
I've been searching and reading about this for a couple of hours, and it seems I'm finding conflicting information everywhere I turn. Much of this is due to old results coming up, and evolving options for Visual Studio 2010.
I know there are several options, but again, I'm having a hard time discerning outdated options from the newer options, and there is some ambiguity in the references people use. Even the popular discussion here has some old/ambiguious/conflicting information.
For example:
Is there a difference between MSTest, Visual Studio Unit Testing Framework, and
Microsoft.VisualStudio.TestTools.UnitTesting
? If so, what? It seems these are different, but have been improperly referenced in some discussions I've seen.Since the author of NUnit also authored xUnit, does that mean xUnit replaces NUnit, thus rendering NUnit deprecated? It seems that some, even today, prefer NUnit. But if NUnit is deprecated, why would one start today using NUnit over xUnit? If NUnit is not deprecated, does this mean xUnit isn't taking off like it was originally intended? Why would the author continue to support two seemingly redundant tools?
Which of these integrates into VS2010 without having to resort to separately executing command lines to test, or having to purchase tools like TestDriven.Net? (I do have ReSharper, though, if this supports any of these.)
Have there been any notable changes recently to any of these that would make older discussions of these invalid?
Are there any others I should consider over or in addition to the ones I've mention above ?
I'm not necessarily looking for an in-depth comparison (though you're more than welcome to provide one if you'd like), but more of an up-to-date consensus of the current tools that are being used today for new VS2010 development.
On the surface, the "Visual Studio Unit Testing Framework" seems to integrate nicely into VS2010 (Pro) out of the box, and seems to be easy to get up and running quickly, as opposed to some of the others, even if it is a bit bloated. But since I'm new, I don't want to get into it 3 months down the road, then realize I've painted myself into a corner just because it seemed easier to pick up.
I also know that this question may be considered a "bad" question by some, due to it's open and broad nature, but while these are different questions, I feel they're all related, and all stem from my general confusion over the ambiguous and conflicting points I'm finding about unit testing in VS2010.
Thanks in advance.
EDIT: This is meant to be more of an updated discussion of the nearly three-year-old popular discussion I linked to above. That discussion has some good points, but a lot of things (could) have changed in three years, and I like a more current evaluation of the subject.
- All the same.. just confusopoly (MSTest is the runner, framework is the DLL). I'll refer to it as MSTest from now on.
- Don't have much mileage with xUnit. I lie firmly in the NUnit camp. Not sure of the history.. but AFAIR Jim Newkirk was even hired by Microsoft for MSTest development. I can definitely answer that NUnit isn't deprecated (or even slowing down). I just got a bug fixed within days of reporting it. Charlie Poole has been heading it for a while (and doing a stellar job). NUnit is the oldest (and based on the xUnit family of test runners that started with Beck's SUnit and JUnit). I've grown up with it (so to speak). It just stays out of the way and has almost all the features you need for day to day development. MSTest offers VisualStudio integration but muddies the waters with tiny subtle deviations that trip me up (parallelization, fixture setup must be static, etc.etc.). The others try to extend the test runner in diff ways (change in terminology e.g. Theories over test-fixtures) and ways in which you write your tests. I've never had to extend my test-runner ; maybe I've not worked in those environments that need it.
- NUnit doesn't integrate off the shelf like MSTest. But if you have Resharper (which you should), it plugs this gap. Also MSTest AFAIK requires a copy of the whole IDE (of a particular edition) unlike NUnit which can be just copied onto a folder and run. Sort of leads you into TFS with "free code coverage if you use MSTest". If your org uses TFS for CI, you will find integrating anything other than MSTest to be "more custom code that I need to write".
4 and 5 things keep changing so difficult to form a final answer.
Summary: NUnit is simpler to learn (will take you a day or less) and most of the literature w.r.t. TDD will go down easier if you know it. I personally never had a reason to move (e.g. NUnit doesn't do this that xUnit does and I cannot live without this). Unless you're big on MS-CI (and "free" Coverage and TestImpact), I'd say start with NUnit and work your way up. No silver test-runner.
The tool doesn't guarantee success, it's how you use those tools. Pick one, get started and adapt.
HTH
这篇关于今天什么是preferred选项,在Visual Studio 2010中的单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!