views:

199

answers:

9

Hi!

I wondered which Unit testing framework would be a good one to get really familiar with? I know this might be a question of opinion, but I thought I'd ask anyways. I know that I will need to do it someday, so I might as well learn to use it. I know that there is quite a few out there, but which one is effective for C# development?

From this question I can see that Unit testing is necessary, but personally I haven't used it. So that's why I ask this question.

+4  A: 

I would go with NUnit

Unit Testing with NUnit

astander
I agree with @astander
thedugas
ReSharper gives NUnit seamless IDE integration (plus many more benefits).
TrueWill
A: 

Hi there.

Check out this question.

Cheers. Jas.

Jason Evans
A: 

Yes I am using NUnit

Upul
+2  A: 

Personally, I prefer the Visual Studio Unit Testing Framework, for two main reasons:

  • It integrates seamlessly with the IDE;
  • It's one less program to deploy in a dev environment.

Having said that, pretty much any unit testing framework will do the trick, the important thing is to have tests!

Aaronaught
+1  A: 

Dont get stuck on choosing a framework. Just pick one and start testing - their not all that different. When you have written tests for a while, you will know what to look for, to suit your needs.

Personally i have found xUnit, Testdriven.Net and Moq to be a very flexible set of test tools.

Also see this post: NUnit vs. MbUnit vs. MSTest vs. xUnit.net

Luhmann
+1 for Moq! Love that framework.
TrueWill
A: 

There are a few reasons for testing, thus a few testing environments. Plus, there are levels of testing, like simple, stubs, and mocks. For example, you could test behavior rather than state.

As far as function, I usually use the Visual Studio built in setup, add a reference to the NUnit dll, and change the c# annotations to be NUnit. This is because I like testing outside of Visual Studio, especially when it involves others on my team (and we didn't buy the team edition of VS yet).

Dr. Zim
A: 

I use NUnit for the testing framework and ReSharper for integrating it into VS (and everything else ReSharper does).

Robert Rossney
Reflector or ReSharper?
TrueWill
Yikes. ReSharper. Fixed, thanks.
Robert Rossney
+1  A: 

Use MbUnit (with Gallio), NUnit, MsTest or xUnit. You can combine several unit tests. I use NUnit for TDD

maxname
A: 

I've decided to stick with NUnit because ReSharper provides native IDE support (which saves a lot of time). It's also supported by TeamCity in running and reporting automated tests.

mythz