Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off test deployment in VS2012

I'm seriously annoyed with this .\TestResults and test deployment mess. Now I'm trying to completely turn it off, but nothing works. From here:

Consider running your unit tests directly in the build output directory, so that testing runs more rapidly. This is especially useful on the build server after you have checked in your tests. To do this, add a .runsettings file to your solution, include False, and select the file in the Test, Test Settings menu. The same effect occurs in any test run in which DeploymentItemAttribute is not used at all. However, you cannot avoid using a deployment folder if you are using a .testsettings file, which is required for web and load tests, coded UI tests, and any test in which you deploy an application to remote machines.

  1. I tried to create an empty solution with only C# Unit Test project that contains single unit test file with single line in it: string text = File.ReadAllText("test.txt"); And guess where it looks up this file? C:\Code\TestDeployment\TestResults\iLonely_ILONELY-PC 2013-02-17 13_33_37\Out\test.txt

  2. I tried to add test.runsettings file to the solution, as described here:

      <!-- MSTest adapter -->
      <MSTest>
        <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
        <CaptureTraceOutput>false</CaptureTraceOutput>
        <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
        <DeploymentEnabled>False</DeploymentEnabled>
      </MSTest>
    

    I selected it through Test -> Test settings -> Select test settings file, ran tests... And the result was the same.

Can anyone explain me how to run tests from Output\bin{Configuration} folder?

IMPORTANT: I don't have a .testsettings file, I don't use DeploymentItem attribute.

like image 503
ptkvsk Avatar asked Feb 17 '13 11:02

ptkvsk


People also ask

How do I stop a test case from running in Visual Studio?

You need to close the Test Explorer Window to prevent automatic running.

How do I enable test in Visual Studio?

Visual Studio 2019 version 16.3 and earlier To specify a run settings file in the IDE, select Test > Select Settings File. Browse to and select the . runsettings file. The file appears on the Test menu, and you can select or deselect it.

What is deployment in Visual Studio?

By deploying an application, service, or component, you distribute it for installation on other computers, devices, or servers, or in the cloud. You choose the appropriate method in Visual Studio for the type of deployment that you need.


2 Answers

I figured out that this is a ReSharper issue. When I run test by VS runner, everything works fine, it runs from Output\bin{Configuration}. When I run test by ReSharper runner, it runs from deployment dir no matter what I do. Now, the question is: how to control MSTest deployment for ReSharper test runner?

like image 80
ptkvsk Avatar answered Sep 30 '22 20:09

ptkvsk


Regarding the followup question of how to control MSTest deployment for ReSharper test runner, I just ran into the same issue and solved it.

By default, it doesn't work, but you can make it work by pointing ReSharper to your .testsettings file according to these directions.

like image 41
Todd Bradley Avatar answered Sep 30 '22 20:09

Todd Bradley