9

I have all my Unit Test project in a folder under my Solution Folder and would like to have the TestResults folder in the same folder as the Test projects instead in the solution directory.

I have found that this could be done via the test seeting file: How to specify the location for the unit test results in VS 2010?

but I also read, that with VS2012 you should no longer use tests settings files. Actually VS2012 does not create one.

Is there another way?

Community
  • 1
  • 1
Thomas
  • 8,397
  • 7
  • 29
  • 39

2 Answers2

6

To specify a different location for the "TestSettings" folder, add a .runsettings to your solution as explained in the Visual Studio documentation: http://msdn.microsoft.com/en-us/library/vstudio/jj635153.aspx

My .runsettings file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>.\Visual Studio Test Results</ResultsDirectory>
  </RunConfiguration>
</RunSettings>

As far as I could tell, however, the ResultsDirectory location is not relative to the solution folder (like the example file from the doc suggests), but rather relative to the location of the .runsettings file itself. Also note that Visual Studio macros like $(SolutionDir) are not expanded here. All in all, .runsettings files are not related to a particular project or solution.

The reason why they recommend using .runsettings files instead of .testsettings in newer version of Visual Studio is also found in the documentation: http://msdn.microsoft.com/en-us/library/vstudio/ee256991.aspx

If you use a .testsettings file, the MSTest test framework will be used to run your tests. This runs more slowly and does not allow you to run tests from third-party test frameworks.

GOTO 0
  • 42,323
  • 22
  • 125
  • 158
4

You can create a small RunSettings file which looks like

  <RunSettings>
     <RunConfiguration>
        <ResultsDirectory>e:\myResultsFolder</ResultsDirectory>
     </RunConfiguration>
  </RunSettings>

Select this setting file via top level menu Test->TestSettings->"Select Test Settings" before running your tests.

You can find more detail on http://msdn.microsoft.com/en-us/library/jj635153.aspx.

Jez
  • 27,951
  • 32
  • 136
  • 233
Patrick Tseng
  • 264
  • 1
  • 1
  • Hi Patrick,I tried it, but the RunSettings file is ignored. The moment I start VS2012 the TestResults folder ist created in the SolutionsDir. – Thomas Feb 08 '13 at 21:42