Search code examples
c#coded-ui-tests

Running Coded UI Test Using MStest


I have a test case i.e created using coded UI. I want to run the test using MStest. I am able to run the test case in my system, but when i try to run in another system , it throws this error "Unable to load the test container 'C:******************\bin\Debug***.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

Can anyone pls tell me why? I tried the answer from this question running mstest from command line against visual studio 2012 native c++ tests, but stil its not working

I am trying to run these coded UI test in a system that has visual studio Professional 2012 only(where coded Ui is not possible , if i am rt).

A question in stack overflow mentioned the same issue, but the solution is to add a dll(Microsoft.VisualStudio.TestTools.UITesting) but where, was not specified.


Solution

  • To execute the tests on a machine that is not set up for development of coded ui, you need to install the Visual Studio Test agent on that machine, and a Visual Studio controller to manage the agent. There's a great article here about configuring that environment.

    After installing and configuring those, create a new TestSettings file in your project that points to the controller and the agents assigned to it. After you've configured it, select the file by navigating to it from this menu:

    how to select test settings file
    (source: microsoft.com)

    Keep in mind that you cannot debug your tests on agents. You must run the tests.