xUnit.net versus NUnit .. what are the pros and cons?

756 views
Skip to first unread message

gerry_lowry (alliston ontario canada (705) 250-0112)

unread,
Nov 18, 2009, 10:35:00 AM11/18/09
to nunit-...@googlegroups.com
Hi ... first, I know, the best way to answer my the question
stated in my subject would be to master both and answer
it myself. Sorry, like most developers, I am pressed for time.
So much to learn. So little time.

Second, please, I am not being a troll. Please do not
flame one another. The question is meant to solicit "objective answers"
to the extent that being objective is possible.

Third, many of you know the saying "if your only tool is a hammer,
all of your problems tend to look like nails". Sometimes having
more than one tool for the same task is advantageous, other times
may be simply overkill.

Fourth, my motivation is two fold. (a) curiosity and (b) deciding
which framework to master first (assuming that both xUnit.net and
NUnit are worth mastering). I have no hidden agenda. I am new
too TDD and test first testing. Ergo, with you cooperation, I
would like to "pick your collective brains".


Therefore, please share your opinions about the pros and cons
of NUnit compared to xUnit.net.


Thank you in advance.

Gerry

Fabio Maulo

unread,
Nov 18, 2009, 11:22:39 AM11/18/09
to nunit-...@googlegroups.com
in term of features NUnit2.5+ is comparable with xUnit so, probably, the choice is only a matter of taste.
in term of addins, addons and so on  NUnit > xUnit
in term of community NUnit > xUnit

btw what is really important is that "you saw the light" (mean: now you know the importance of tests).

2009/11/18 gerry_lowry (alliston ontario canada (705) 250-0112) <gerry...@abilitybusinesscomputerservices.com>

--

You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=.





--
Fabio Maulo

Jeff Brown

unread,
Nov 18, 2009, 11:40:37 AM11/18/09
to nunit-...@googlegroups.com, <nunit-discuss@googlegroups.com>
Both frameworks are similar but xUnit.net is simpler in some ways and
directs you down a happy path that will help you avoid many common
unit testing pitfalls. On the other hand, NUnit has been around longer
so you might find it easier to find articles and books about it.

You can choose one now and switch later. For the most part changing
frameworks amounts to a search and replace (altough there are some
subtleties).

Jeff

On Nov 18, 2009, at 7:35 AM, "gerry_lowry \(alliston ontario canada
\(705\) 250-0112\)" <gerry...@abilitybusinesscomputerservices.com>
wrote:

Charlie Poole

unread,
Nov 19, 2009, 7:49:16 AM11/19/09
to nunit-...@googlegroups.com
Hi Gerry,

As others have said, what's important is that you are doing

> Hi ... first, I know, the best way to answer my the question
> stated in my subject would be to master both and answer it
> myself. Sorry, like most developers, I am pressed for time.
> So much to learn. So little time.

Sure... it's a reasonable question.

> Second, please, I am not being a troll. Please do not flame
> one another. The question is meant to solicit "objective answers"
> to the extent that being objective is possible.

Don't expect complete objectivity here. The list is frequented
by people who use and work on NUnit. OTOH, I would not expect any
flaming on this list either.

> Third, many of you know the saying "if your only tool is a
> hammer, all of your problems tend to look like nails".
> Sometimes having more than one tool for the same task is
> advantageous, other times may be simply overkill.

Most xUnit implementations are fairly equivalent, subject
to the objectives of the developers. Start by reading the
high-level info about each project, where it exists, so
you understand why (for example) one may aim for backward
compatibility and another may not. It's easier to interpret
lists of features once you have this background.

As a coach/consultant, I tell my clients who don't use any
test framework to use NUnit, because I can best help them
with NUnit - sometimes providing custom code. OTOH, I tell
those already experienced with a framework like mbUnit or
xUnit.net to stick with it and work with those frameworks
myself. A developer with the right skills will create good
tests in any one of these frameworks.

I also advise clients *not* to use NUnit for acceptance
testing, leaning toward Fit if they don't already have
something.

I mention all this because I think my own view is fairly
common in this community: these frameworks are more alike
than they are different, and you can learn well on any
of them and switch easily should the need arise.

> Fourth, my motivation is two fold. (a) curiosity and (b)
> deciding which framework to master first (assuming that both
> xUnit.net and NUnit are worth mastering). I have no hidden
> agenda. I am new too TDD and test first testing. Ergo, with
> you cooperation, I would like to "pick your collective brains".

Mastery takes a while but just learning to use either of them
won't take you long. You may want to consider spending two
weeks with each of them first, unless some of the specific
points people list lead you to choose one over the other.

>
> Therefore, please share your opinions about the pros and cons
> of NUnit compared to xUnit.net.

* One point that is often overlooked: xUnit.net requires .NET 3.5
or higher - I assume 4.0 is on the way. NUnit can run tests using
.NET 1.0, 2.0, 3.0, 3.5 or 4.0, Mono profiles 1.0, 2.0 or 3.5 and
compact framework (via NUnitLite) 1.0, 2.0 or 3.5. Silverlight
support is coming in NUnit 3.0. If backward compatibility has any
importance to you, this may be worth considering.

[That's a great example of what I meant by looking at the high-level
goals of each framework. NUnit has a goal of retaining backward
compatibility. We may or may not succeed at it, of course, but a
project that doesn't have it as a goal won't do it at all. It's up
to you to decide if that's important to you - as well as any of
the other high-level goals.]

* NUnit provides a number of ways to run tests: one AppDomain,
multiple AppDomains, single process, multiple process, etc. Via
pNUnit, you can run parallel distributed tests. More general
parallel testing is coming but it's probably coming in xUnit.net
as well.

* NUnit is trying to implement Theories in a way that is consistent
with JUnit and with David Saff's research on the subject. xUnit.net
simply uses 'Theory' to mean what we call a data-driven test.

* NUnit is moving (with 3.0) toward support of other kinds of tests
besides unit tests. AFAIK, xUnit.net isn't going that way.

* xUnit.net currently has some easy ways to do certain kinds of
extensions at the framework level. NUnit has a harder-to-use approach
that is more broadly applicable to doing things like extending the
Gui as well. We're borrowing some of the xUnit.net approach in
3.0 so that simple things can be done more simply.

[That last is something to bear in mind. When you just list features,
what is missing one month from one of them will appear the next month.]

Others may have more points to share.

Charlie



Reply all
Reply to author
Forward
0 new messages