Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# .NET 4.0 Testing Framework?

If I'm not mistaken, NUnit is the de-facto standard for unit testing, but I've just downloaded it, wrote a simple test, and then apparently I have to fire up the GUI and load my .exe assembly, which simply failed.

I tried editing

C:\Program Files (x86)\NUnit 2.5.7\bin\net-2.0\nunit.exe.config

As suggested in this question, but that didn't work either, so I tried downloading the nunit source code and compiling it in vs2010, but it doesn't even compile. Says punit.framework.dll could not be found. That solution says "does not contain a definition for AllTestsExecuted", so I'm getting a little frustrated here. You'd think there would be an easy-to-use-and-get-running framework for .net 4, no?

So my question is, how do I either get NUnit working, or is there another framework that will cause me less agony?

like image 239
mpen Avatar asked May 17 '26 04:05

mpen


2 Answers

You don't have to use the NUnit GUI to run your tests. You can use TestDriven.NET from within Visual Studio. Also, if you happen to be using Resharper, that has a unit test runner which works with NUnit also.

like image 195
Jason Evans Avatar answered May 19 '26 18:05

Jason Evans


If you're not doing anything out of the ordinary, I recommend Microsoft's Unit Testing Framework. I find it's VS integration too easy to even worry about NUnit. I agree NUnit seems to be the defacto standard, but if you're looking for something quick and easy. Microsoft's way is the easiest for a typical Visual Studio programmer IMHO.

like image 31
Steve Danner Avatar answered May 19 '26 19:05

Steve Danner