Spent several hours today trying to write some unit tests against an ASP.NET project. It's Visual Studio 2010.
Using Windows 7 Enterprise with IIS7.
Steps I took were:
Added a new test project to the solution
Opened a class file as part of the web site (Member.vb)
Right clicked within the class file and "Generate unit tests"
Select the methods I wish to generate stubs for, choose to add to my test project, click OK
Open up the generated MemberTest.vb file in the test project, click within one of the generated tests, click "Run tests in curent context"
When following these precise steps on my Windows XP Professional with IIS6 machine it works fine.
However on the Windows 7 Enterprise machine on IIS7 I get:
The URL specified ('http://localhost/MyProject') does not correspond to a valid directory. Tests configured to run in ASP.NET in IIS require a valid directory to exist for the URL. The URL may be invalid or may not point to a valid Web application.
You're probably using the default directory (C:\users\<user>\Documents\Visual Studio 2010\Projects) where the app identity pool does not have permission. You should create a new project in something like C:\webs and make sure app pool identity has permission
to the folder.
bgs264
Participant
1083 Points
211 Posts
ASP.NET unit testing with Windows 7 / IIS 7
Jan 30, 2012 02:36 PM|LINK
Spent several hours today trying to write some unit tests against an ASP.NET project. It's Visual Studio 2010.
Using Windows 7 Enterprise with IIS7.
Steps I took were:
When following these precise steps on my Windows XP Professional with IIS6 machine it works fine.
However on the Windows 7 Enterprise machine on IIS7 I get:
So what's going on, I can confirm I can browse to http://localhost/MyProject and it displays perfectly.
I feel sure I'm missing some sort of config in Windows/IIS but I'm really at a loss.
(Cross-posted at StackOverflow)
unit testing Windows7
timamm
Member
34 Points
7 Posts
Microsoft
Re: ASP.NET unit testing with Windows 7 / IIS 7
Feb 05, 2012 08:34 PM|LINK
bgs,
Unit testing might not really be the issue here.
You're probably using the default directory (C:\users\<user>\Documents\Visual Studio 2010\Projects) where the app identity pool does not have permission. You should create a new project in something like C:\webs and make sure app pool identity has permission to the folder.
Follow the steps on Rick Anderson's excellent blog post at http://blogs.msdn.com/b/rickandy/archive/2011/04/22/test-you-asp-net-mvc-or-webforms-application-on-iis-7-in-30-seconds.aspx and then see if you can hit the site.
Hope this helps,
Tim