Which unit testing framework?
C#.NetUnit TestingC# Problem Overview
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.
C# Solutions
Solution 1 - C#
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!
Solution 2 - C#
I would go with NUnit.
Some links: NUnit QuickStart, NuGet Package
Solution 3 - C#
Don't get stuck on choosing a framework. Just pick one and start testing - they're 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
Solution 4 - C#
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.
Solution 5 - C#
I use NUnit for the testing framework and ReSharper for integrating it into VS (and everything else ReSharper does).
Solution 6 - C#
Use MbUnit (with Gallio), NUnit, MsTest or xUnit. You can combine several unit tests. I use NUnit for TDD
Solution 7 - C#
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).