Simon_Weaver
Simon_Weaver

Reputation: 145950

How to copy an arbitrary file into a Visual Studio test run 'out' folder

I am trying to use a third party product secured with XHEO licensing and write unit tests against it. I can get the .lic file to copy to the regular project's bin directory (with either a post build or 'build action'), but the actual test itself doesnt seem to be running from there but from a constantly changing 'out' directory.

A license window pops up saying

'No licenses found in r:\websites\example.com - mvc\testresults\sweaver_a770-win7u-pc 2009-11-17 16_02_01\out.'

That output directory is time based and changes on every unit test run - so I cant even manually copy the lic file in there!

How can I copy an arbitrary file to this directory - or disable the constantly changing path?

PS. I've tried renaming the .lic file to either .txt or .xml to see if its because the filetype is .lic, but it still never appears in the out directory.

Upvotes: 1

Views: 1314

Answers (2)

Marc
Marc

Reputation: 1898

Have a look at this this article:

http://chakkaradeep.wordpress.com/2008/07/14/team-system-unit-test-and-output-directories/

Resource files can be copied to the Out folder by adding the <Solution>\<Assembly>\bin\Debug\ directory to the Deployment section of the testrunconfig file (via Test > Edit Test Run Configurations > Local Test Run).

This means that if you've set your resource files to be copied to the \bin\Debug\ folder these files will be included in the Out folder for your unit tests. Works a charm for me.

Upvotes: 1

stimms
stimms

Reputation: 44064

In order to make the results directory static look for a file called local.testsettings and under the root TestSettings element add

<NamingScheme baseName="output1" appendTimeStamp="false" useDefault="false" />

Where output1 is some test output directory.

Upvotes: 2

Related Questions