xUnit.NET Fanatic

I’m very fanatic when it comes to test driven development (TDD). Too often people are writing complex applications without testing it proper. It happens to me as well. This has in general 3 reasons:

  1. Sometimes I’m just lazy. Laziness is a general developer disease which occurs a lot.
  2. No buddy to review my testresults. Your buddy should be someone at your level, someone who can review your work in a functional way, but he also has to speak on the same technical level. If not, eXtreme Programming becomes useless as you won’t be able to supply each other feedback.
  3. Don’t know where to start. This one is the most important reason. A lot of programmers don’t know where to start with simplistic unit testing, mocking, etc. I’ve had the same problems. I’m glad that Visual Studio, TestDriven.Net and ReSharper have integrated test functionality these days.

Back to my title: xUnit.NET. A new Unit-test framework. Another one?  Yes! Written by the mister James Newkirk, a NUnit veteran. He was responsible for NUnit v2 and learned a lot from the design mistakes they’ve made. A couple weeks ago he announced this new test-framework.
I’m working and reading with/about it for 2 weeks now and I’ve to say, I’m impressed! The framework is designed to fit exactly in the .NET Framework, it has support for Generic, Nullable types, etc and it’s even more simplistic. For example, they’ve limited the amount of possible attributes, the framework uses constructors and IDisposable instead of SetUp and TearDown.
The Assert object is 50% smaller. It has less unreadable methods and overloads. Personally I’m extremely happy with the ExceptedException replacement. In this case viewed with anonymous delegates:

Assert.Throws<InvalidOperationException>(delegate { operation(); });  // .NET 2.0      
Assert.Throws<InvalidOperationException>(() => operation());  // .NET 3.5

Everybody who is interested should visit, read carefully and follow the updates on the following pages:

All above together: I’m a xUnit.NET fanatic from now on. Expect more on this topic later!

Enough at this late Tuesday evening.
But remember… It not just about the tool… 😉

3 thoughts on “xUnit.NET Fanatic”

  1. Thanks Brad, voted.

    Looking forward to the upgrade document – it would be really cool if we could just write new tests in xUnit, while keeping the old ones in nUnit for now, instead of one big migration.

Comments are closed.