Daveo Daveo - 2 months ago 29
C# Question

Microsoft.VisualStudio.TestTools.UITesting, Version=

We recently switch from Visual Studio 2013 to 2015, same goes with Microsoft Test Manager.

I created CodedUI test in the same way that i was creating it in VS2013. Associated it with test case and then try to run it as Automated Test from Microsoft Test Manager. Unfortunately i keep getting this error:

Error adding test case [16730] to test run: Unable to load the test container '\NAS\UTV\TFS2012\NOO\Automated Tests\Automated Tests\Automated Tests_20160310.5\testcodedui.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

This is probably due the changes in automated tests in VS2015 (no test controllers etc.).

Is it possible to use Test Controller and Test Agent 2013 with VS and MTM 2015? Anybody know solution for this?

Answer Source

Typically Your 2013 Test agent comes with the libraries for Coded UI 2013 (V12), when you create a test these references are added automatically by Visual Studio.

In your case, you have 2015 VSTS, ergo references of Coded UI from 2015 (V14) will be in your test. But, when you run the test, your 2013 agents will not able to find the references you have in your test. TO fix this, you will need to remove all coded UI refrence which are added by default and add your Own.

  1. Make a note of all Refrenced dll in your test and note where they are located.
  2. Create a lib folder under your solution and copy all refrenced dll to that folder and add them to the solution (note not reference just add them)
  3. There are couple of implicit reference in Coded UI (Reference of your references) You can identify them from this link

  4. Add them to your lib folder as well.

  5. Select your .csproj file ==> Right Click ==> Unload Project
  6. Right click Again ==> Edit .csproj file
  7. See if you have any import statement which import Testtools.target template and comment it. The reference would be something like this "Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')""
  8. Close your project and reload it.
  9. Add a reference to all the dlls u added under lib folder form your project.
  10. Compile and make sure you dont find any build errors.

After this, associate your test, hopefully it should run. If u still get any missing file error, then you are missing a implicit reference. Just search for in your programfiles directory of 2015 VSTS and add to your project refrence thru lib folder. It should work !!