What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

Deploying Sub folders for VS Unit Tests

My unit test project uses a app.config file that has external source references to other config files located in my “configuration” folder.  My configuration folder is a sub folder of the unit test project.  When the unit test runs, I need to deploy this folder to the TestResults/Out folder so the app.config can be properly loaded during test execution.

 

Here’s the easiest way to accomplish deploying folders to the TestResults folder:

 

  1. Right click on the .testrunconfig file in your solution explorer.  For me, its LocalTestRun.testrunconfig.
  2. Select Open With and select XML editor
  3. Add a deployment item, specifying the relative path as the file name and an outputdirectory value of the directory name.  In my example, I want to deploy everything in the configuration directory to a folder called configuration in the testrun folder, so I’ve added the following entry:

<Deployment>
  <
DeploymentItem filename="Services\Identity\Claim\ClaimService.Test\configuration\" outputDirectory="configuration\" />
</
Deployment>

Now when my tests execution, Visual Studio copies over all my configuration file entries and is able to load the app.config file successfully.

Print | posted on Thursday, January 28, 2010 12:10 PM | Filed Under [ Visual Studio ]

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: