Executing Tests with MSTest
Please note that MSTest is a command line utility from Microsoft that executes tests created in Visual Studio. This is not a command line tool that is a part of Test Studio. More information you can find here.
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.
Note: Read here how to create test lists in Visual Studio 2012 or later.
3. Right click List of Tests and choose New Test List.
4. Name the New Test List and click OK.
5. From the Test View pane, drag and drop the tests into the Test List Editor and Save the project.
6. Close Visual Studio and open the Visual Studio Command Prompt.
7. Navigate to the project's directory.
- C:\Users\Admin\Documents\Visual Studio 2010\Projects\MSTest-Tutorial\MSTest-Tutorial
8. To execute a single test, enter the following:
- mstest /testcontainer:.\GoogleSearch.tstest
9. To execute a test list, enter the following:
- mstest /testlist:SampleTestList /testmetadata:..\MSTest-Tutorial.vsmdi
10. Open Visual Studio and load the same project. Go the Solution Explorer pane.
11. Right click "Solution Items"and choose Add > New Item.
12. Highlight Test Settings on the left, again in the center, and give it a unique name. Click Add.
13. The Test Settings window appears. Click Telerik Test Studio on the left, and then click the Web tab.
14. Change the browser to Firefox and click Apply and Close. Save the project.
15. Close Visual Studio and open the Visual Studio Command Prompt.
16. Navigate to the project's directory:
- C:\Users\Admin\Documents\Visual Studio 2010\Projects\MSTest-Tutorial\MSTest-Tutorial
17. To execute a test list with a custom settings file:
- mstest /testlist:SampleTestList /testmetadata:..\MSTest-Tutorial.vsmdi /testsettings:..\FF.testsettings
18. To specify the output location for a results file, add:
- /resultsfile C:\Path\myResults.trx