I have Coded-UI test project that has references to other assemblies in solution. Somehow some assemblies are not copied to TestResults/Out
directory, while oth
I've seen this before. Your test project references other projects but when the tests run you'll notice that the assemblies are not present in the TestRun Out folder.
Unlike other test runners that run unit tests from a fixed location, MSTest copies the assemblies that it requires to a test run folder where the tests are executed. The design allows you to compare test results, coverage, outputs between test runs.
The common misconception is that somehow compilation settings like "Copy Local" will somehow influence which dependencies are used for testing, which is simply not true. MSTest uses reflection to determine assembly references that are required for the test run.
The error you are seeing is likely caused because you've referenced the assembly but the test assembly is not directly using it. You can verify this by using a IL inspection utility (DotPeek, Reflector, etc) to look at the test-assembly references. (This is often a problem in WPF projects that reference assemblies in the XAML.)
To fix, either use the DeploymentSettings to copy the assembly to the output folder; or use the assembly in the test project. For example, adding the following to your test project will emit IL that ensures the assembly is deployed:
var type = typeof(AssemblyNotBeingCopied.MyClass);