views:

1059

answers:

7

Hello. I've a project in .NET Framework 3.5 and as i can see nUNIT does not support it yet. What unit testing framework would you recommend for my needs?

+2  A: 

I've been trying out Gallio and it seems to work nicely. It plays nice with ReSharper's unit test runner, too.

[edit]

Just thought I'd mention that Gallio is the next evolutionary step from MbUnit, so it's not an entirely new thing.

Rytmis
+8  A: 

NUnit works perfectly well in .NET 3.5 - I've been using it (with ReSharper running the tests) since the betas of VS2008.

Jon Skeet
@Tomaszs- I've also used NUnit with .NET 3.5. You need to remember that .NET 3.5 is really CLR 2.0 + some additional DLLs.
RichardOD
Hello, I've created example solution and when i try to run it in NUnit 2.5 I get error: System.NullReferenceException... at NUnit.Util.TestLoader.ReloadTest(RuntimeFramework framework)
tomaszs
Are you going to post a link to this solution? Have you alerted the NUnit team to it? Does it definitely work with just .NET 2.0? It feels like you're rushing to an unwarranted conclusion here.
Jon Skeet
@Jon SkeetIf you feel that its unwarranted then please give my proof that 3.5 is supported because I have a project I did in 2.0 and changed to 3.5 and I have error mentioned above when I add it's assembly. I will send project as soon as it will be uploaded
tomaszs
@Jon Skeet, And no, i didn't alert NUnit because I need a working unit testing solution now, just in this very moment.
tomaszs
@Jon Skeet: Here it is, http://www.2shared.com/file/6370216/8f70e4b9/AplikacjaTestuTestowania.html
tomaszs
Okay, I'll have a look. My "proof" that .NET 3.5 is supported is that .NET 3.5 is generally backwardly-compatible with .NET 2.0, which is clearly supported - and that I've been using .NET 3.5 with NUnit for a couple of years with no problems.
Jon Skeet
That site isn't letting me download the zip file with Chrome on Linux, Chrome on Windows or IE on Windows. Furthermore it's trying to bombard me with adverts. Could you upload it to a better site?
Jon Skeet
@Jon Skeet Strange, i've moved it to other website: http://uploadfile.org/download.php?id=e0qzljUeDBeOc1Cv56fz
tomaszs
tried on NUnit 2.5 / VS2008 got AplikacjaTestuTestowania.KlasaDokumentTest.TestBleduPrzygotowania:System.FormatException : Input string was not in a correct format.problem is in these linesstring k = "pi * silnia z 2";int l = int.Parse(k);surely you cannot parse that as int
Petar Repac
You could try to run nunit2.5 from console to diagnose the problem. It works at my machine:C:\PetarR\Shared\Downloads\aplikacjatestutestowania\AplikacjaTestuTestowania\AplikacjaTestuTestowania\bin\Debug>nunit-console AplikacjaTestuTestowania.dllNUnit version 2.5.0.9096 (Beta-3)Copyright (C) 2002-2008 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig.\r\nAll Rights Reserved.
Petar Repac
+1  A: 

As Jon said NUnit works fine with 3.5.

There are a few things you need to keep in mind:

  1. There are some (very few) obscure breaking changes when you upgrade to later versions of the framework, usually due to the use of deprecated APIs or non-standard methods. In my experience fixing these kind of breaking changes is usually fairly simple once you catch where its coming from.

  2. If you are getting a particular bug with NUnit, isolate it in a tiny test suite. When hunting for bugs I usually assume its my fault and usually I am right.

  3. The source code for nunit is out there you can compile and debug into issues. Testing frameworks, in general, are fairly straight forward and easy to follow.

  4. There are plenty of other unit testing frameworks. The more opinionated XUnit framework is gaining popularity. Personally, I like fluent assertions but its a personal taste thing that can also be achieved with NUnit.

  5. You can always fall back to Microsoft's built in unit testing framework, which ships with VS.

Sam Saffron
+3  A: 

Some other unit testing tools for .NET 3.5 would be:

  • MS Test - the built-in unit testing framework in Visual Studio. It's not nearly as bad as its reputation.
  • xUnit.NET, which has a very nice API.
Mark Seemann
-1 for mstest, but +2 for xunit ;-)
Matt Briggs
A: 

I get the same null reference error, brand-new 3.5 project with a simple Assert.IsTrue(true)....when I try to add the assembly to my NUnit project in guirunner I get:

System.NullReferenceException... at NUnit.Util.TestLoader.ReloadTest(RuntimeFramework framework)

+1  A: 

Personally, I use MSTest since it is built into Visual Studio. It just makes it easy since you don't have to install anything in order to use it.

Chris Pietschmann
+3  A: 

I ran into this issue as well, and was able to work around it, in NUnit 2.5.

In the NUnit GUI, turn on Visual Studio support under Tools > Settings...

Now choose File > Open Project... Change the file filter from "Projects & Assemblies" to "Solutions", and load your solution file. You should be able to run all of your tests.

Now choose File > Save As... and save the current setup as an NUnit project. You can now go into Project > Edit... and remove non-test assemblies or make any other changes you need.

starkos
I have the same problem :/ but your solution worked for me.THANKS!
Piotr Owsiak
Second time I had to look up this answer. THANKS!!!
Torbjørn