Executing Tests with MSTest

You can also review our Telerik TV episode on Executing Tests with MSTest for a video walk-through of this process.

  1. Open Visual Studio. Create a project containing two tests. In this example, I've create two simple Web Tests: GoogleSearch and BingSearch.
  2. Click Test Windows Test List Editor.
  3.  

     

  4. Right click List of Tests and choose New Test List.
  5.  

     

  6. Name the New Test List and click OK.
  7.  

     

  8. From the Test View pane, drag and drop the tests into the Test List Editor and Save the project.
  9.  

     

  10. Close Visual Studio and open the Visual Studio Command Prompt.
  11. Navigate to the project's directory.
    • C:\Users\Admin\Documents\Visual Studio 2010\Projects\MSTest-Tutorial\MSTest-Tutorial

     

  12. To execute a single test, enter the following:
    • mstest /testcontainer:.\GoogleSearch.tstest

     

     

     

  13. To execute a test list, enter the following:
    • mstest /testlist:SampleTestList /testmetadata:..\MSTest-Tutorial.vsmdi

     

     

  14. Open Visual Studio and load the same project. Go the Solution Explorer pane.
  15. Right click "Solution Items"and choose Add New Item.
  16.  

     

    Note: In Visual Studio 2008, the default configuration file is LocalTestRun.testrunconfig.

     

  17. Highlight Test Settings on the left, again in the center, and give it a unique name. Click Add.
  18.  

     

  19. The Test Settings window appears. Click Telerik Test Studio on the left, and then click the Web tab.
  20.  

     

  21. Change the browser to Firefox and click Apply and Close. Save the project.
  22. Close Visual Studio and open the Visual Studio Command Prompt.
  23. Navigate to the project's directory.
    • C:\Users\Admin\Documents\Visual Studio 2010\Projects\MSTest-Tutorial\MSTest-Tutorial

     

  24. To execute a test list with a custom settings file:
    • mstest /testlist:SampleTestList /testmetadata:..\MSTest-Tutorial.vsmdi /testsettings:..\FF.testsettings

     

     

    Note: Visual Studio 2008 uses runconfig instead of testsettings.