1

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?

3
  • Why do you need explicit support for .NET 3.5? After all, it's still the 2.0 CLR, and if I remember correctly, NUnit supports 2.0. Commented Jun 19, 2009 at 8:25
  • What do you mean by this? I have project in .NET 3.5 and with nUnit 3.5 I get NullReferenceException. So it seems that it's not supported Commented Jun 19, 2009 at 8:52
  • We've been using NUnit on a 3.5 project for 15 months. It works just fine. But, have you tried creating a new project in 3.5 with just one simple Assert.IsTrue(true) in one single test? That should eliminate the possibility that it is in your code. Commented Jun 20, 2009 at 7:09

8 Answers 8

8

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

Sign up to request clarification or add additional context in comments.

11 Comments

@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.
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)
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 If 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
@Jon Skeet, And no, i didn't alert NUnit because I need a working unit testing solution now, just in this very moment.
|
5

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.

Comments

3

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.

Comments

3

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.

1 Comment

I have the same problem :/ but your solution worked for me. THANKS!
1

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.

1 Comment

The fluent assertions portion was extracted into a library of its own called Should Assertion Library or simply called as Should. You can write framework agnostic asserts using a library called Should. It also has a very nice fluent syntax which can be used if you like fluent interfaces. I had a blog post related to the same. nileshgule.blogspot.com/2010/11/…
1

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.

Comments

0

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)

Comments

0

After built the dll in .net framework 3.5,if we used it in NUnit it works fine but if you want to integrate the NUnit with the Visual Studio IDE You need to change the configuration files in order to execute. But im not sure how to do that

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.