2
votes

I have been running Visual Studio 2008 Team Edition for some time now and need to start using nunit. I loaded nunit 2.4.8 but nunit is not showing as a selection for a testing framework. This is the selection you see when starting a new project and it asks if you want to setup a testing project and which framework you wish to use (only displays Visual Studio Unit Test).

EDIT: The only choice I do get is the "Visual Studio Unit Test" the one installed with VS2008. I have only tried it in a new MVC project. I will try in some other project types and see what choices I get. Trying web project and winforms, unit testing isn't an option at the start of the project; which somewhat makes sense to me.

Update: I found a setting in the nuit GUI interface at Tools > Options; from the options tree IDE Support > Visual Studio. There is a checkbox to enable Visual Studio Support. I thought it was a home run, but after checking it, restarting apps, XP, etc. still the same issue where nunit isn't an option as a testing framework.

I know this should work as I described as Stephen Walther used nunit in his tutorial video with Charlie Poole of nunit.

7
Can you update your question with what choices do you see? On all projects? This will help to enlighten others on the TFS Editions of VS2008.BuddyJoe
Never heard of this option.. but I'd suggest adding a Nunit.Framework.dll reference to a class library project, tinker it to taste and then doing a File > Export Template for future projectsGishu

7 Answers

2
votes

The Visual Studio integration is not provided by NUnit currently. However, you can create templates yourself that work the same way. For NUnit, you can find instructions and templates created from those instructions. There are also templates that others have created, you just need to google for them.

From the comments to the Walther/Poole video, this appears to be the method used to get the NUnit option for that demo.

2
votes

I found that my post here is a duplicate: Adding NUnit to the options for ASP.NET MVC test framework

The accepted answer: Adding NUnit to the options for ASP.NET MVC test framework

I must say I am pretty disappointed that Charlie Poole hasn't released a template which works with nunit and vs2008. I really don't wish to build my own and don't know enough about templates to know how worthy one is from someone else.

The last three responses to this post (thank you for the response) say the same thing so I am not sure who will get the accepted answer. laugh

According to the MVC site comments this may be the template used in the tutorial. No response from the presenters, as usual.

1
votes

Integrated testing with nUnit is available in ReSharper...(this is just one of the fine features of this product) I use it all the time.

Apparently it's also available with TestDriven.NET (I haven't used this product)

1
votes

Alright.. seems like a MVC Tooling goodie.. not available for the rest of us. Found this link that seems to do what you want...

ASP.NET MVC Test Framework Integration

You need to mess around with the registry to get NUnit registered as a testing framework. See Step 2.

1
votes

The template that Stephen Walther used can be found here: ASP.Net MVC Test framework integration. This link provides working demos whereas Gishu's link only provides all the registry magic. The demos are horribly out of date and not practically useful in their current state, but you could fix them up to suit your needs.

0
votes

Nunit does not offer built-in Visual Studio integration. There might be 3rd party solutions you can try. As far as I know, you create Nunit tests by adding the references to the Nunit libraries in a normal class library. You run the tests in a separate test runner outside of Visual Studio.

There are other ways to integrate Team Foundation Server with Nunit. For example you can use custom build tasks to integrate the Nunit tests into your TFS build process.

0
votes

It doesn't really matter as all you need to do is create a new class library project and add a reference to nunit.framework.dll and you are good to go.