in

Platinum Bay

Peace, Love and Visual Studio Team System

.NETicated

Unit Test Deployment Woes

One of the common complaints I hear about Unit Testing in Visual Studio centers around test deployment. By default, when you run a unit test, the assemblies get copied to another location to be run. The assemblies and test results are copied to the following folders:

    <Users Documents>\Visual Studio 2008\Projects\<Project Name>\Test Results

There are then subfolders based on the username, computer name, date and time, and further sub-folders representing the inputs and outputs of the test(s).

For most scenarios, this behavior is transparent and doesn't cause problems. If your assembly has dependencies however, unit tests can fail as the dependencies are not deployed automatically. You can attach deployment dependencies by double-clicking the LocalTestRun.testrunconfig file in the solution root, going to the Deployment tab, and adding any necessary files or directories that should be deployed with the assembly.

But this is a bunch of extra work, and can be viewed as 'friction' by some. Fortunately, there is another option. Many of the folks who complain about the deployment feature of Unit Tests point to NUnit as having an option to turn deployment on or off.

As it turns out, Unit Tests have the same option, and it was right under my nose the whole time. In the same Deployment tab, there is a checkbox at the top titled "Enable Deployment". By un-checking this options, you can tell the test framework not to deploy assemblies to another location before running the unit tests.

If you would like to make non-deployment the default option, you can modify the LocalTestRun.testrunconfig file in the "C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Testing Tools\TestProjectCommon\Templates\RunConfig\1033" directory by changing the Deployment node to:

    <Deployment enabled="false" />

There is one caveat however; code coverage, remote execution, and device test projects all require deployment, so turning it off will disable this functionality.

Comments

September 3, 2008 6:07 AM

Pingback from  Dew Drop - September 3, 2008 | Alvin Ashcraft's Morning Dew

 

September 8, 2008 5:18 AM

Willy-Peter Schaub on Team Foundation Server 2008 in Action: Review (Part 2 of 5) Steve Andrews on Unit...

 

Leave a Comment

(required )  
(optional )
(required )  
Add

About Steve

Steve Andrews has been working as a developer for more than 8 years. During this time, he has designed and developed applications in such widely varying areas as trust accounting, medical information management, supply chain management, and retail systems. He has firsthand developer experience with a variety of languages, including Java, VB, and .NET. Most recently, he has been immersed in SharePoint. He is currently employed at RDA Corporation in Philadelphia, PA, as a Software Engineer and a team member in the Architectural Guidance evangelism team. Steve is also an MTCS (x2), ICSOO, and .NET fanatic.
Powered by Community Server (Commercial Edition), by Telligent Systems
© Platinum Bay | Some Rights Reserved Creative Commons License

Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or annonymous comments) - so keep it polite, please.