Issue #1: Can’t generate tests for a Web Application Project
1. Add the Web Application Project Assembly via the “Add Assembly…” button (located on the bottom left of the dialog).
a. After adding the assembly, you may get an error message box saying: “One or more of assemblies you selected could not be loaded. Please check those assemblies are valid and try again:”; just hit OK; and afterwards, you will be able to select the methods that you want to generate tests against.
2. After generating the tests, you must add the correct namespace (Microsoft.VisualStudio.TestTools.UnitTesting.Web) and the proper attributes to the test method for the test to execute properly. The required attributes include [HostType] (set to ASP.NET), [AspNetDevelopmentServerHost] (set to the path to the web site), and [UrlToTest] (set to the URL to test). For example:
///A test for Class1ConstructorTest
public void Class1ConstructorTest()
3. That’s it, you’re ready to go!
Issue #2: When running ASP.NET unit tests against an ASP.NET Development Server (A.K.A. Cassini), they fail with the following error message: “Could not find WebDev.Webserver.exe”
3. Issue #3: Can’t generate tests for an ASP.NET Web Site Project
Unfortunately, we don’t have a workaround for this problem. The only thing that will work in this scenario is having a Visual Studio Team System 2005 web site project, and opening it in Orcas (going through the conversion wizard, which should be automatic when opening any old project in Orcas).Hope this helps.
Thanks,David Gorena Elizondo