views:

2749

answers:

3

When I build a unit test project before the tests are executed the test output is copied to a TestResults folder and then the tests are executed. The issue I'm having is that not all the files in the Debug/bin directory are copied to the TestResults project.

How can I get a file that is copied to the Debug/bin directory to also be copied to the TestResults folder?

EDIT: Here is a link to a similar question on another site (no answer there though), http://www.eggheadcafe.com/software/aspnet/29316967/files-and-unit-testing-wi.aspx

+1  A: 

Try out the Post-Build event command line from within Visual Studio (if you are using that IDE).

Kasper
I am, but that seems like a bit of a hack. This has to be a fairly common scenario and I hope there is just some option or property I am not properly setting.
spoon16
+18  A: 

The standard way to do is by specifying the deployment items in the .testrunconfig file, which can be accessed via the Edit Test Run Configurations item in the Visual Studio Test menu or in the Solution Items folder.

Mark Cidade
Exactly what I was looking for. Thanks!
spoon16
In VS2010 this is: Test/Edit Test Settings/local, then in the list, select "Deployment", check the "Enable..." box and add the file(s).
Marcel
You may have to close your solution (or even Visual Studio) and reopen before this change takes effect properly
RobV
+1  A: 

You can specify deployment attribute like an example shown below; Also you need to set "Content" & "Copy if newer" property ( there is no documentation on the later settings, but you have set those to make it work.

[TestMethod]
[DeploymentItem("mytestdata.xml")]
public void UploadTest()
{



}
Sanjay10