Setting up remote execution of Coded UI Tests Via MTM


  • I have searched high and low for clear set of instructions for my case. I have even followed instructions from Testing for Continuous Delivery with Visual Studio 2012 book.

    The query is: I would like to run my coded ui tests from Microsoft Test Manager.

     - I have created Coded UI Tests in VS2012 that work
        - This is a separate solution from the web application all together

     - I use TFS2012 to manage the web app solution

     - The test controller has been setup on the same server as the web application
        - The test controller has been configured to work with the tfs default project collection

     - The Test/Lab Manager has been setup on my PC
        - I have added a standard virtual environment

     - I have associated a test case to a coded ui test

    The next step is where I am stuck...All of the forums and the book state that I need to create a deploy - build - test process. Since my coded ui test solution separate from the web application does this change anything, if not, how do I go about doing this?

    If my understanding is correct once my coded ui test solution is built,

     - I need to deploy it to some directory in the virtual environment created via Lab Manager
        - This will drop the coded ui test dlls into some directory

     - I can than use Lab Manager to run the test which will use vs2012 on the virtual environment to run the coded ui test from the dlls

    Please correct me if I'm wrong, and provide steps that I can use to finish of the set-up for my case.

    Thank you all in advance!

    • Edited by Oleg Pantsjoha Friday, December 07, 2012 1:59 PM
    • Moved by Forrest GuoModerator Tuesday, December 18, 2012 2:12 PM restructure forum (From:Visual Studio Lab Management)
    Friday, December 07, 2012 1:58 PM

All replies

  • Ok, you have most of this correct. The parts where I think you are tripped up on are "How do I get this code to an environment and hook this all up?" Everything below is targeted toward TFS 2010, but the principles should be the same for TFS 2012.

    I've set up exactly what you are describing, so here's what you'll need to do. You need the location of the solution for your web application, and if there is a separate solution for your automation tests, you'll need that too. You'll need to set up a build definition (or modify an existing one) to build the web application and tests. You will also need to associate the automation/Coded UI tests to test cases. In MTM, you'll need to set up a test suite that includes the test cases that have automation tests associated.

    Once you've done that, you'll need to set up a build definition using the lab management template. In there, you can configure it to use your virtual environment. You'll also want to specify the other build definition that compiles your web application and automation tests. After you've done that, you'll have to specify some method of deployment (if you didn't use MSDeploy/Web Deploy in your other build definition). Once you've handled the deployment, on the "Test" tab, you'll need to find the Test Plan and Test Suite that contains your automated test cases. At this point, everything should be hooked up and working. If you are still running into issues, please feel free to reply and I'll help you out. I've also included some links below to the 2012 documentation for you to follow to help set this up.

    How to: Run Automated Tests from a Build-Deploy-Test Workflow

    How to: Associate an Automated Test with a Test Case

    Monday, December 10, 2012 4:13 PM
  • Thank you for you reply, unfortunately that's pretty much what every forum and online guides stated. Having locked myself in the office with endless cups of coffee, I realized there was no need of lab management template unless you would like to automate nightly runs later (which I have and they run fine). Moreover I have no need for deployment procedure in my case since my automated test are in a separate project. The Web App project build is dealt with separately.

    What the actual problem was that my main build for the Coded UI Test projects was not specifying the location of project DLLs. Once I've sorted that out all else was a breeze. I am now able to run the tests via MTM or VS Build.

    When I get a minute I'll compile a document with simple instructions for others.

    Friday, December 14, 2012 11:14 AM
  • I'm very curious as to why you had to do that. I have a feeling that you are referencing something from the project DLLs in your Coded UI projects (or some other form of coupling) and that's why you had to do that, but if that's the case, you should also be able to make the assembly references to be copied to the output folder in your Coded UI Projects. If I remember correctly, you probably had to go in to the automation test settings in MTM and specify an extra folder to grab the project DLLs.

    Also, when the DLLs for the automation tests are copied to the machine running the test agent, they are placed in the following folder on the test agent machine: %SystemDrive%\Users\[Test Agent Account]\AppData\Local\VSEQT\QTAgent\[Some GUID]\[Machine Name]\Deployment\

    The part after "QTAgent" may be different, FYI.

    Friday, December 14, 2012 1:59 PM