How To: Run Coded UI Tests From Command Line


How To: Run Coded UI Tests From Command Line

One of my previous posts about Coded UI I showed how to Run CodedUI Test From Another Application.
In this post I’ll show how to use Mstest to run Coded UI Tests thought command line.

  1. Open up with Visual Studio 2010 Command Prompt Window.
  2. Browse to your Test directory.
  3. Enter the following command prompt to run all tests
    Mstest /testcontainer:TestProject.dll /test:CodedUITest1



Add comment
facebook linkedin twitter email

Leave a Reply


  1. falkdj16/11/2010 ב 22:02

    Thank you for your very informative post!

    I was wondering if you would be able to clarify something, for me.

    I see that you can choose a certain CUI Test in a Test project with the “/test” option. Assuming a CUI Test has multiple Test Methods inside of it, is there a way to control the execution order of the Test Methods? It appears that the default execution order is alphabetical.

    Thanks very much!

  2. shair18/11/2010 ב 01:44


    You will need to create Ordered Test and there you can define the right Test Order.

  3. Balaji02/06/2011 ב 16:21

    I am only having framework 4.0 installed in my system. Can i able to run it ?

    I tried this


    Mstest /testcontainer:TestProject.dll /test:CodedUITest1

    but error is comming mstest is not recognized

    Mail me if you can

  4. Chevy B26/01/2012 ב 01:18

    You must first do a change directory command (CD) to the directory where your test.dll resides. See step 2 in the example above