views:

1031

answers:

14

I've been using NUnit for a few years. I've tried MBUnit for a short while as well as Zenebug and XUnit but I keep coming back to NUnit.

What is your favorite/most used Unit test Framework? Can you explain why you're using it?

+18  A: 

Nunit for the win!! It is simple and easy to implement. No mess, no fuss.

Craig
+3  A: 

I've used Nunit for quite some time, but I happen to prefer things baked into VS. So, I'm now using MSUnit. Just a preference for having less add-ins installed in VS.

Jason N. Gaylord
+2  A: 

I like xUnit because of the way it uses the constructor and Dispose methods instead of having to apply attributes to other methods for initialization and all that.

Max Schmeling
+7  A: 

MbUnit

I like the way it handles reports, and I'm looking forward to some of the upcoming features I've heard about, such as integration with JsUnit.

Sam Wessel
+1  A: 

I used to use NUnit, but now I prefer the framework that comes with Visual Studio 2008, simply because it has tighter integration and is easier to set up to test private methods.

We also had problems with keeping the versions of NUnit synchronized with the rest of the team. It was a minor annoyance (go and upgrade, or fix the project references), but it went away with the switch.

C. Lawrence Wenham
I would try to not directly test private methods. The internals aren't usually what you're concerned about when testing. I take the black box approach: some input gives me some output that is supposed to be correct.
casademora
+10  A: 

xUnit.net, but I'm hardly unbiased. :)

Why I use it: http://www.codeplex.com/xunit/Wiki/View.aspx?title=WhyDidWeBuildXunit

Brad Wilson
+3  A: 

NUnit. We can use it on CC.

Mariano
+2  A: 

MbUnit has compatible syntax with NUnit but has more features (especially data driven tests).

craigb
Can you elaborate on that - what features do you like most
Dror Helper
+4  A: 

Gallio looks like it's going to be awesome once it gets more stable (currently alpha).

It's not just a test framework, but a test automation platform, so it will work with many existing test frameworks (MbUnit, NUnit, xUnit.net) yet be fully extensible, with a number of built-in additional features such as report generation in many formats and code analysis tools.

I've also heard that it will be able to

  • output image streams, so for example WatiN test failures can be output as screenshots, so you can see what state the browser was in when the test failed.
  • filter by namespace, so you can easily uncheck tests for an entire namespace before running them

Edit: It is indeed out of alpha now. We've tried it at our company and we really hated it. It was horrible to use and very slow. What a shame.

Sam Wessel
+1 but it's not alpha anymore
Mauricio Scheffer
+6  A: 

I've used nUnit for years, but when we moved to VS2008 and TFS 2008 (using TeamBuild) we decided to try MSTest. No huge complaints there... we really like how well it integrates with the IDE as well as the CI build server.

One new thing we're trying which looks to have awesome potential is another add-on from Microsoft Research called Pex (requires VS2008). As they put it: "Pex generates unit tests from hand-written parameterized unit tests through automated exploratory testing based on dynamic symbolic execution." The way I put it is: this thing does static analysis on your unit test and target code and codegen's unit tests to achieve super high code coverage (which is often impractical if you're doing it by hand).

Kevin Dostalek
+2  A: 

The support for NUnit tests in Resharper is great and sets the bar very high for me moving away from NUnit. I can run all the tests in a solution directly from Visual Studio, or I can drill down and concentrate on specific tests. When my code is checked in, my continuous integration build runs the same tests. This gives me a lot of confidence in my development process.

Lee
+1  A: 

MSTest

http://en.wikipedia.org/wiki/MSTest

I don't know if it's my favorite (haven't really tried many others), but it's convenient since it's built into Visual Studio.

Chris Pietschmann
+1  A: 
  1. xUnit - less ceremony, support for data driven testing and other extentions
Scott Weinstein
+1  A: 

I've been using NUnit for some 4 years now, would definitely recommend using it. Reshaper - a plugin for VisualStudio by JetBrains includes a UnitTestRunner which integrates nicely with VisualStudio and lets you run / debug your tests from directly from the IDE. Resharper, NUnit and RhinoMocks is my preferred suite of tools for UnitTesting.

vikram nayak