Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It seems to me that everyone uses NUnit without even considering the other options. I think this is because:

  • Everyone is familiar with it already so they won't have to learn a new API.
  • It is already set up with their continuous integration server to work with NUnit.

Am I wrong about this?

I decided to use xUnit on one of my own projects recently and I love it! It makes so much more sense to me and conceptually it seems like a definite step forward from NUnit.

I'd like to hear opinions on which framework is actually the best - not taking into consideration having to learn it or reconfigure your automated testing.

share|improve this question
4  
Please define best. Cheapest? easiest to code? fewest lines of code per test? stackoverflow.com/questions/680298/… –  Amir Rezaei Feb 16 '11 at 11:39
    
Sorry, I meant most powerful, stable and intuitive, whatever. I'm asking for opinions and reasons why. I left 'best' to the answerer's imagination because I would also like to see which of those aspects are important to people. –  rmx Feb 16 '11 at 11:42
2  
If you can reword your question then it might be OK, otherwise this is just a "list of X" question which aren't constructive. See six guidelines for constructive subjective questions –  ChrisF Feb 16 '11 at 12:02
1  
"best" is a dumb thing to ask - because there is very rarely a single best partly because it will depend on context and partly because it is inevitably to some degree subjective. –  Murph Feb 16 '11 at 12:44
9  
Murph. First, this site is for subjective questions. Second I'm asking for opinions so I'd like to see others' interpretation of 'best'. And don't call me dumb. –  rmx Feb 16 '11 at 13:15
add comment

closed as not constructive by Mark Trapp Dec 5 '11 at 3:44

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

The one reason is NUNIT become more industry standard than xUnit. But personally, i love xunit.

share|improve this answer
add comment

Picking one and using it is perhaps the most important step here.

Personally I would choose NUnit for a few reasons. First and foremost is tooling support. There is a free add-in for Visual Studio 2010, and all major 3rd party plugins support it. Every single build system, test coverage utility and CI server supports it. In many cases without a plugin. On the code level, it can handle just about any scenario at this point -- data driven tests, inheritance, abstract test classes, generic test classes, setup, tear down, etc. To some extent we have xUnit because NUnit got too feature rich and powerful.

Beyond NUnit, I think you could make a pretty decent argument for MBUnit + Gallio as mentioned by Yann -- it is a very solid framework. The one you should avoid if at all possible would be MSTest, which has a few fatal flaws IMHO. Flaws being some of the constraints on your test classes, such as no inheritance, and dependencies on professional or better visual studio SKUs. Including requiring visual studio be installed on the build server in order to run the tests.

share|improve this answer
add comment

MSTest

I personally use MSTest. NUnit is really nice, but in VS2010, MSTest is already fully integrated into the IDE and there are full project templates for it. For .NET, if you're using 2010, then I think MSTest is the way to go (MSTest in VS2008 I don't think is up to par) simply for the code coverage, test runner and other tools that are available to you out of the box. (If you use CodeRush or R#, then they have really great test runners/tools for other testing frameworks)

share|improve this answer
    
I voted up for both MbUnit/Galio and this answer. MbUnit/Galio is simply better, but their hands are tied when it comes to running MsTest tests, for some critical classes in that .Net library are final and not extendable. However, if you have to do GUI automation, then Coded UI and cuite.codeplex.com/documentation work on top of MsTest, so one just HAS to use them. –  Job Dec 5 '11 at 3:24
1  
The issue I have with MSTest is that it does not natively support command line testing, this can be an issue when you want to run units via CI. –  CmdrTallen Jan 20 at 14:20
add comment

I've started to use Gallio/MbUnit several years ago. And the features and gems it provides are just so powerful that I've never regretted my choice. In fact, I'm now part of the development team of the Gallio OSS project; so I can contribute to make it even more awesome.

  • MbUnit has many powerful features that just make my developer life easier (contract verifiers, test factories, structural equality comparer, combinatorial tests, data generation framework, text diffing, xml assertions, extension points, etc.)
  • Gallio provides a consistent platform to run all my tests with a nice reporting tooling. I'm also fond of the fact that I can integrate tests from other OSS projects which do not use MbUnit and just run them along. Seamless integration within many 3rd party tools is also convenient (R#, PoSh, dotCover, etc.) And the extensibility of the infrastructure is amazing (for example, I've just finished to write a test adapter for a native unmanaged C++ testing framework. It will be part of a future release soon)

The wiki is certainly a good starting point to discover Gallio and MbUnit v3. It sill misses some chapters but it's quiet useful already.

share|improve this answer
    
Structural equality comparer and data generation framework sound great. Can MbUnit do data-driven testing - i.e. read csv / xsd files and use them as test method arguments? That's one of the main attractions of xunit for me. –  rmx Feb 16 '11 at 13:20
    
Sure. ASAIK MbUnit was the first testing framework for .NET to introduce data-driven testing. It can bind test paremeters to internal ([Row], [Column], etc.) and to external ([CsvData], [XmlData], etc.) data sources. More details here: gallio.org/wiki/doku.php?id=mbunit:data-driven_testing –  Yann Trevin Feb 16 '11 at 13:41
    
Have they fixed the performance problems they were having with Gallio and visual studio? Was the deal killer for us. –  Wyatt Barnett Feb 16 '11 at 17:00
    
I used MbUnit when I worked for a small company and it was great! I later used MsTest because I had to, and it worked out ok. I still prefer writing explicit code over configuring project settings. The corporate backing does help MSTest though. Whether the design is ugly or beautiful, you know that whatever comes out of MSFT will be well tested. –  Job Dec 5 '11 at 3:27
    
@YannTrevin What's the status of Gallio/MbUnit? I looked at the Google Code repository and it doesn't seem to have any recent changes. Is development happening somewhere else or is the project stalled? –  Wesley Wiser Jul 17 '13 at 14:14
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.