How do I stop the Development Server starting during Unit Testing? - visual-studio

I have a Visual Studio 2008 solution that contains around 30 projects. Some of these are web services / WCF services / ASP.NET MVC applications.
When I run all unit tests (Ctr+R, A) it insists on spinning up all the Development Servers for these various projects. This means that it takes far too long to run the tests and, actually, none of my unit tests require these frameworks.
So, how do I stop Visual Studio doing this?

Click on the projects in your solution and bring up the properties window (F4).
Change Always start when debugging to false.

If you're running the tests, not debugging, then the "Always start when debugging" setting will have no effect.
Instead, have a look at the test settings that you're using to run the tests. (Find which settings you're using by going Test > Select Active Test Settings. You can then edit the test settings by going Test > Edit Test Settings and selecting your active test settings)
I have found the following test settings can force the ASP.NET development server to start up, although there could be more!
Non-default test host: In the edit test settings window, choose the "Hosts" section. Host type should be set to "Default", not "ASP.NET"
Code Coverage: In the edit test settings window, choose the "Data and Diagnostics" section. Select "Code Coverage" and click "Configure". The development server will start for each service that is selected here for ASP.NET Code Coverage. (Normal code coverage is identified by an icon of a blank page with two gears on top of it. ASP.NET code coverage is identified by an icon of a globe with two pages on top of it.) To change from ASP.NET code coverage to normal code coverage, deselect the ASP.NET code coverage, then choose "Add Assembly...". Browse to the bin folder of your web service project and choose the dll of the web service.

Related

How can I find out what debugger is attached to w3p.exe

I'm trying to setup debugging on a class ASP project in VS 2010, and in doing that am trying to attach it's debugger to w3p.exe. I'm using Windows 7 64-bit and IIS 7.5. I've used this method successfully a few times before on another machine.
However, I'm finding that this time I am unable to attach the debugger. It's saying:
Unable to attach to the process. A debugger is already attached.
But I can't figure out what it might be. How can I determine this? Or could it be something else? I've rebooted my PC and can't yet see signs of anything running which looks like a debugger.
Setup
In case it helps, here's the steps I used to setup the environment, which I documented from my previous successful attempts:
Created new empty Visual Basic .NET Web (Best to create in C:\inetpub\wwwroot\, otherwise you will have security/ACL issues when loading the site).
Copied the contents of site folder to project folder.
In solution explorer, selected to show all files not in project. Selected all files and right click and select: "include in project".
Under project properties -> Web -> Set to use IIS and start with URL http://mysite.local
In hosts file pointed mysite.local to 127.0.0.1
In IIS setup new website pointing to the files with a host header of mysite.local
Go to application pools, ensured mysite.local was set to classic mode. No managed code.
Under ASP -> Enable Parent paths and make sure server-side debugging is enabled
Under error pages, make sure full details are shown.
Debugging in Visual Studio 2010
Run VS 2010 as Administrator
In your project, use Ctrl+F5 to run without debugging
Now, in the menu go to Debug -> Attach to Process -- This is where I fail
Tick show processes from all users AND show processes in all sessions
Make sure it is set to automatically determine type of code to debug
Look through the w3p.exe processes in the list, and based on the IIS POOL\site name, pick the right process.
Set your breakpoints and refresh -- debug as normal.
Are you having some Debug Diagnostics Tool running on your machine. Sometimes back i had the same problem the Debug Diagnostics Tool was debugging my w3p process.

MSTest in VS2010 - How to launch all loadtests in a single step

In the new team I work for we use a lot of unit tests, we use MSTest in VS2010.
I have prepared about 10 loadtest to use these unit tests in various ways. How do you launch all the loadtest (randomly or with a specified order)?
I'm having trouble how to get the standard VS environment to do this.
Or maybe there is a plugin to add to Visual Studio?
Open the Test View window, by selecting Tests --> Windows --> Test View
In the Test View, select Group By: Test Type.
Right click on the Load Test category and Run Selection.

How to keep IIS Express running after finished debugging?

I'm using IIS 7 express to test a ASP.Net MVC 3 project on my development machine and normally it keeps running after I finished debugging, which is a good thing so that I can perform small tests directly in the browser without needing to run the project again.
But if I choose the option "Enable edit and continue" on the project properties IIS 7 will only run while debugging the project. Is there a way to change this behavior?
No, because in order to achieve this, Visual Studio uses a hosting environment that interprets the code being executed.
So, it is only available while debugging.
There is global setting in Visual Studio to have 'Edit and Continue' to be off by default for all new projects under Options > Debugging > Edit and Continue.
Just in case if you need this feature (IIS to continue running) in ASP.NET Web Forms, instead of pressing F5 (Run), right-click the start page in Solution Explorer and select 'View in browser'.

"View Test Results" is missing from TFS 2010 web access build summary?

I'm using vs\tfs 2010 to queue builds with tests. When using vs to queue the build, I can access the "View Test Results" in the build summary. But when I queue the build using the TFS web access, this link is missing from the build summary.
My guess is that opening test results requires Visual Studio or Test Manager. Even so, I wouldn't see the harm in allowing you to download the file(s). As a cheap work around you could click "View Log" and scroll down towards the bottom to see the test results.
Additionally, you could create a custom build control to display a hyperlink to the build results:
http://www.ewaldhofman.nl/post/2010/05/27/Customize-Team-Build-2010-e28093-Part-8-Send-information-to-the-build-log.aspx
http://www.ewaldhofman.nl/post/2010/10/02/Customize-Team-Build-2010-e28093-Part-13-Get-control-over-the-Build-Output.aspx

Debugging a site using web service with Visual Studio 2008

I've got a solution with many projects
One of these proejcts is a "MyProject.Web" web application.
This has a web reference to MyProject.WebService" project -
I have a breakpoint in the WebService project, and i call the method on one of my Web forms, the break point is not hit....
How can i enable this?
Right-click on the solution and choose "Set Startup Projects". Choose to start multiple projects and select both your web site and web service to start with debugging. Then when you start the debugger they will both fire up and you should have full debugging in both.
I ran into this too a while back and this is what I followed:
http://dansen.wordpress.com/2008/04/15/debugging-wcf-clients-and-services/
Visual Studio has feature that
supports attaching to multiple
projects when starting up.
In this example, I have a WCF service
hosted in IIS which lives in the
Wcf.Demo.IisServiceHost project. I
also have a Wcf.Demo.TestHarness
project which calls the service. I
want to be able to attach the debugger
to both the client and service by
simply pressing F5.

Resources