When using NUnit and the test project, we haven't been able to find a way to step into the class we are testing in a web application. We are using TestDriven.NET add-in for Visual Studio 2008. We are able to hit a breakpoint in the test project, but not step into the web app class that is being tested.
views:
141answers:
1You may have to manually attach the debugger to the IIS or built in web server process depending on what type of web application you are developing. Manually attach the debugger once you've hit a break point in your unit test using the "Debug" menu, "Attach to Process...".
This is, of course, assuming you are attempting to access a class that's only valid when the web application is running (such as a web service).
If that's the case you may want to look at a mocking framework, such as Moq or RhinoMocks so your tests can execute independent of such dependencies.
If its a class that is valid even when a host application (IIS or the built in web server process) isn't running then its likely because the compilation and symbol generation occurs after the debugger is already running attached to your unit tests. In this scenario an easy fix would be to physically separate the classes into its own class library assembly and then refer to that assembly (project) from the web application project.