Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why My test Binaries are getting copied into TestResults\<somepath>\out folder?

I am facing this unusual behavior from my Visual Studio where all of a sudden my test binaries(mytestsolution.dll) and the dependency binaries which are added in reference, are getting copied into TestResults\\Out folder from my Bin folder and starts executing from there?

This results in my tests getting failed as my GetExecutionAssembly() is giving the path of the Out Folder instead of Bin folder where some of the dependent binaries exist?

Could any one please help me how to stop this?

like image 763
satya Avatar asked Feb 11 '13 13:02

satya


People also ask

What is Copytooutputdirectory?

"Copy to Output Directory" is the property of the files within a Visual Studio project, which defines if the file will be copied to the project's built path as it is. Coping the file as it is allows us to use relative path to files within the project.


2 Answers

Little too late to the party but here what I just learned from my experiment

Env: net45, VS2017, Microsoft.VisualStudio.QualityTools.UnitTestFramework

When my TestMethod has DeploymentItemAttribute, it executes from TestResults\....\Out folder. When I remove DeploymentItemAttribute it executes from bin\debug.

like image 86
T.S. Avatar answered Sep 30 '22 18:09

T.S.


Visual Studio 2010 creates a folder TestResults and deploys all relevant files in subdirectories with the following schema: username_computername date time.

This is the normal behavior if you don't have a .testsettings file for your solution. The .testsettings file is situated in folder Solution Items.

If you have a .testsettings file, it depends on the setting of Enable Deployment in the Deployment section. If Enable Deployment is checked, the TestResults folder will be created and filled.

enter image description here

In some cases it is possible that the TestResults folder will be created although Enable Deployment is deactivated. But in this case the folder is used only for some temporary files, not for the execution files of your tests.

For more infos see:

MSDN - Test Deployment Overview

like image 31
Knasterbax Avatar answered Sep 30 '22 16:09

Knasterbax