Reputation: 823
I use VS2010. In my test project I have a folder named "MessageInstances" and in that folder there is a subfolder "GET_ACTIVITY", inside that folder there are xml files.
When I run a test, these files should be copied accordingly to the out assembly dir, i.e. if Out
is the folder where my test project output is copied then Out\MessageInstances\GET_ACTIVITY\
folder should be filled with my xml files.
I tried different settings with *.testsettings
file, tried running the test from Resharper unit test runner and from VS', but neither copied the files into the right folder. Also I played with DeploymentItem
attribute and still no success.
What else can I try?
Upvotes: 3
Views: 2398
Reputation: 6834
Per MSDN , you can also try this if this helps,
To select files or folders to deploy, in run configuration
In Solution Explorer, under Solution Items, double-click the run configuration file that you want to edit.
A dialog box that has a name such as .testrunconfig appears. Click Deployment.
Under Additional files or directories to deploy, specify additional files or folders to be copied.
To do this, click Add file to select files; this opens the Add Deployment Files dialog box.
You can also click Add Directory to select folders by using the Add Deployment Directory dialog box.
In the .testrunconfig dialog box, click Save and then click OK.
These deployment items will be copied to the deployment folder whenever this run configuration file is active.
Hope this will help.
Upvotes: 0
Reputation: 3492
The DeploymentItem attribute will only work if Build Action on the item is set to Content and the Copy to Output Directory is set to Copy if Newer or Copy always. Additionally, if your tests are running with a testsettings file you need to enable Deployment in the settings. Make sure you are editing the active test run config in case you have mutiple.
Your DeploymentItem should be defined as follows:
[DeploymentItem("MessageInstances\\GET_ACTIVITY\\", "MessageInstances\\GET_ACTIVITY")]
Or using '@' instead of '\\'
[DeploymentItem(@"MessageInstances\GET_ACTIVITY\", @"MessageInstances\GET_ACTIVITY")]
i.e. you need to specify the output directory, otherwise the files will be copied to the Out directory of your test run.
Upvotes: 3
Reputation: 28435
Some my colleagues experienced the similar problem with ReSharper MS test runner. The bug was specific for ReSharper 7.1 and has been fixed in current 7.1.1.
See http://youtrack.jetbrains.com/issue/RSRP-335233#tab=Comment
Upvotes: 0
Reputation: 1705
If you bring up the properties of the files in the solution explorer, verify that the files are set to Build Action: Content
and Copy to output director: Always
Upvotes: 1