Note that there are some explanatory texts on larger screens.

plurals
  1. POIn which secret, magical directory does a VS unit test execute?
    primarykey
    data
    text
    <p>So, my first VS(2012)/NUnit unit test experience...</p> <p>The unit test project is referencing assembly A (the code which needs to be tested), which requires assembly B. So, I have also referenced assembly B. Both files are copied to the output directory.</p> <p>However, when I run the test, it fails because it cannot load assembly B. Odd, it must be running the test from another directory. </p> <p>So, I open up Resharper, disable shadow copy. Still fails. </p> <p>Double and triple check all necessary files are referenced and in the output directory. They are.</p> <p>Start to do some research, find <a href="http://msdn.microsoft.com/en-us/library/ms182475%28v=vs.90%29.aspx" rel="nofollow">this article</a>, which implies that I can disable deployment and just run the test from my output directory. However, my unit test project has no "run configuration file" that I can find, but it is required in step one of the walk through. Drat.</p> <p>I then stumble across the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute%28v=VS.90%29.aspx" rel="nofollow">DeploymentItem</a> attribute. I add this to my test method and, lo and behold, it works. However, I'd rather not pepper every test method with this attribute forevermore, so I'm looking for a better solution.</p> <p>Does anyone know how to just tell the darned test framework to copy all of the files in my output directory <em>or</em> to just run the thing from that directory to begin with? This seems like it should be simple and default instead of magical and hidden... thanks in advance.</p> <p>I'm gonna go ahead and vent. This is one of the most brain dead design decisions I have ever encountered. They have the project file, they know which assemblies/files are referenced, they know if they are set to "Copy Always"... yet they ignore all of that. </p> <p>The default behavior is to run only the most trivial of "Hello World" projects and break everything else, wasting my/your time. What are these developers thinking? ...Feel better now.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload