Adds a project and an item template to generate NUnit based tests of ASP.NET MVC 3 and ASP.NET MVC 4 applications. NUnit as NuGet package is included and does not require any dedicated installation anymore.
This extension finally makes getting NUnit test templates into your MVC3 applications easy; something which has always been a major point of pain for developers.
There's nothing particularly elaborate that happens here, the extension is simple and effective. Your NUnit project is not created with the latest production release of the NUnit framework (at time of writing, the latest version is 2.5.10 where the template installs with 2.5.9) but this is forgiveable and one would assume that regular updates would correct this issue periodically, although perhaps more attention could be paid to the NUnit release cycle.
Project classes and references are all named correctly and the suite of AccountController classes are thorough and correct.
Overall, this makes life infinitely easier for plugging NUnit test templates into your MVC3 projects.
I'm having problems using this extension. When creating the project I get:
Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages':
Newtonsoft.Json.4.5.6 : Unable to find version '4.5.6' of package 'Newtonsoft.Json'.
Microsoft.AspNet.Razor.2.0.20710.0 : Unable to find version '2.0.20710.0' of package 'Microsoft.AspNet.Razor'.
might be that some packages were update to new versions. Will try to fix the templates to have a minimum required version and not to have a fixed version. As I am of to the build conference soon new version might be delayed slightly.
sorry for the delay. I fixed the extension for VS2012 now (http://visualstudiogallery.msdn.microsoft.com/3c266165-7142-4012-974c-fa750cf97850) but when I tried to fix it for the VS 2010 I came across the situation that my assemblies still have the old version. Might it be that you guys have VS2010 and VS2012 installed in parallel and that VS2012 has update 3 installed?
I am running version 0.6 and upon creation of a new solution with a NUnit test project, I get a Package Installation Error. It cannot find the following Newtonsoft.Json.4.5.6 and Microsoft.AspNet.Razor.2.3.20710.0.
Is it missing some dependencies? Installing with default test package generates no errors.
those dependencies are linked from the ASP.NET MVC 4 repository - which MVC version do you have installed? The MVC 4 repository should be somewhere like: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages all dependencies should "live" there.
thanks for your reply.
Checking that directory, I see I have version Newton.Json.4.5.11 and Microsoft.AspNet.Razor.2.0.20715.0. It looks like we are not matching on version.
Having said that, my supervisor has announced we are going in a different direction, making this whole discussion academic from my point of view.
have you tried the VS2012 extension (http://visualstudiogallery.msdn.microsoft.com/3c266165-7142-4012-974c-fa750cf97850) ? I needed to separate VS2010 and VS2012 because of the NuGet references inside the templates.
Have you tried to install from within the Extension Manager or the plain VSIX?
Ah - my fault ;-)
Yes, I did use that one. I stupidly didnt take note of the fact that is the same extension but for different versions of VS.
And, yes, this one worked perfectly.
Thank you for your very prompt response.
unfortunately Express versions do not have any built-in support for testing projects which this add-on depends on. So quick answer is "no" ;-)
Only possibility is to add NUnit reference and project manual.
hm - I am geting outdated ;) I recently saw that my statement is incorrect! :( The VWD version should be able to have extensions and test-support. So I am checkin for VWD compliance.
I installed the version .5. When I create a MVC3 App it supports nunit as the unit testing framework. But when it comes with MVC4 it doesn't.I saw in a review someone asking "Do you plan on updating this or doing another one to support ASP.NET MVC 4?". Isn't it supporting MVC4 apps. Thanks in advance.
I am assuming you are using VS2012? Until yesterday I was struggling hard with problems for VS2012 support. I was able to solve these and guess what... I am having already the next ones. ASP.NET MVC 4 uses nuget to embed its assemblies. The path to the packages is written into the registry (which is a bad thing I think). The main problem: the key to the registry is different on VS2010 and VS2012 (aka VS11). In the .vstemplate file there is no "condition" based on VS version possible. So I could either break VS2010 support and just go with VS2012 (which I don't want) or spend another time to have a special wizard extension to support different VS versions. I figured that out just yesterday (which took a really long time because there is no documentation on that). As I am doing this in my spare time I gues you have to be patient a little more time ;) There will be an update coming up the next weeks supporting VS2010, VS2012, MVC3, MVC4, C# and VB.
Hadn't had a chance to look deeper into it by now. Only solution so far I can think about is to drop backwards compatibility with MVC 3 (would wonder if still someone is using that - and if so no upgrade would be required). Then I could release v0.6 soon. But I would like to look into the problem by one more time - maybe I find some time at the weekend.
I'm getting the below error on brand new box. I've update VS sp1 and april '11 tools update. There is no FormsService off the AccountController. Any idea what's going on?
'MvcApplication4.Controllers.AccountController' does not contain a definition for 'FormsService' and no extension method 'FormsService' accepting a first argument of type 'MvcApplication4.Controllers.AccountController' could be found (are you missing a using directive or an assembly reference?) c:\users\danieleli\documents\temp\MvcApplication4\MvcApplication4.Tests\Controllers\AccountControllerTest.cs 128 71 MvcApplication4.Tests
Hey, I am getting the same problem. The Accounts controller does not contain either FormsService or MembershipService as I believe it should based on other code I've seen for MVC3. The test utility method GetAccountController() tries to create a Account Controller with these variables, but they don't exist so the whole thing fails and none of the tests can be used.
I'm woundering if the Accounts controller code in the template is from a differenct version of MVC or something strange like that?
Just as an update I think there may have been changes to the Account Controller for security reasons (Open Redirect Attack).
You can also see progress on development here:
this problem is due to Tools Update for ASP.NET MVC 3 as they changed the default project template and its controller classes. This will be fixed in vNext coming up shortly. Temporary solution could be deleting the faulted tests (as they are only a template).
Thanks for pointing out the problem.
After downloading the file ASP.NET MVC Nunit.vsix from your site, I click on it to install and I get error message "This extension is not installable on any currently installed products" I have VWD Express 2010 sp1 and MVC3 and Windows 7 Pro. I want to be able to create NUnit test projects. I wasn't able to do it in VWD 2008 Express, i was hoping it would work in 2010 Express. Please help