Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MsTest DeploymentItem OutputDirectory in testsettings

How can I specify output directory when I create DeploymentItem in testsettings? It is easy when you apply DeploymentItem attribute to method or class (there is a special constructor parameter) but I don't see a way to apply it in testsettings (and even UI doesn't contain anything like this).

like image 343
SiberianGuy Avatar asked Feb 15 '12 07:02

SiberianGuy


2 Answers

Try editing the testrunconfig file either from VS or using an XML editor - right-click and choose open with and add a line like this one:

<Deployment>
    <DeploymentItem filename="rootdir\SomeDir\" outputDirectory="SomeDir" />
like image 193
Dror Helper Avatar answered Nov 13 '22 01:11

Dror Helper


In visual studio 2010:

  1. Go to Test
  2. Edit Test Settings
  3. .testsettings
  4. Go to Deployment
  5. Add your file 'myfile.txt' via Add File...

Close Visual Studio 2010

Go to your project root directory in windows explorer Open the .testsettings file Locate this line:

<DeploymentItem filename="<somedir>\<otherdir>\myfile.txt" />

change it to the output directory that you want:

<DeploymentItem filename="<somedir>\<otherdir>\myfile.txt" outputDirectory="<otherdir>" />

Start Visual Studio 2010 again :-)

For Visual Studio 2012:

http://msdn.microsoft.com/en-us/library/ee256991.aspx

Unit tests run more slowly if you use a test settings file. We recommend that you do not use a test settings file with unit tests. You can configure unit tests by using the .runsettings file instead. To deploy additional files, use DeploymentItemAttribute.

But web performance and load tests always use a test settings file.

Upgrading from 2010 to 2012: http://msdn.microsoft.com/en-us/library/hh507838.aspx

like image 45
juFo Avatar answered Nov 13 '22 00:11

juFo