1

I've recently noticed that if your source code that you are running in VS 2010 or 12 is not located on same drive as to where your IDE of choice is running, then some weird behaviors can be observed.

var location = Assembly.GetExecutingAssembly().Location;

I have a simple MSTest unit test that runs the above and yeilds the below:

C:\Users\Ibrar\AppData\Local\Temp\ckiwsrev.qh0\A-----.Main.Tests\assembly\dl3\7e61424f\b0b1ebcc_318ace01\A----.Main.Tests.dll

Even though my source code is located on an external drive ... can any one shed any light on why this seems to be getting copied and pasted into the AppData folder and ran from there?

Is there anywhere of forcing VS to run the tests from where the source code folder is located?

I suspect it may have something to do with trust, security and permissions?

Linked Questions/Same Questions: How can I get “Copy to Output Directory” to work with Unit Tests?

Community
  • 1
  • 1
IbrarMumtaz
  • 3,846
  • 5
  • 39
  • 58

2 Answers2

2

This is the expected behavior. When you installed Visual Studio, it also installed 2 extra services:

  • Test Agent
  • Test Controller

These services are used to execute tests. When you hit run from Visual Studio, it sends the request with all sources to the available and selected Test Controller and the later sends the same request to all agents that are connected to it and shares to them the tests that they have to execute.

Each agent and controller can be installed at any machine (physical or not) at your network. So, the source code have to be copied on a specific folder on each machine so each agent can access it. It would be impossible for them to access the code on your local pc.

The same procedure takes place in your case. You have just decided to run your tests in your local pc. However, the Controller and Agent are still part of the whole procedure and Visual Studio needs them in order to execute the tests.

chaliasos
  • 9,173
  • 6
  • 46
  • 83
0

Basically, from what I can tell there does not seem to be way to do this to force VS to run your test directly from the bin folder.

Seems like the answer to this for now is to use Deployment Items.

IbrarMumtaz
  • 3,846
  • 5
  • 39
  • 58