How to: Run a Load Test from the Command Line

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional 

Visual Studio Express

Topic applies Topic does not apply Topic does not apply Topic does not apply

You can run your load tests among the other test types from the command-line. For more information, see How to: Run Automated Tests from the Command Line Using MSTest and MSTest.exe Command-Line Options.

After you start a load test from the command line, you can monitor it while it is running. You can also analyze it after it has completed. For more information, see How to: Access Load Test Results for Analysis.

  • Running a Single Load Test from the Command-Line

  • Running Multiple Load Tests from the Command-Line

  • Running a Distributed Load Test from the Command-Line Using a Test Controller and Test Agents

  • Specifying the results file name

Running a Single Load Test from the Command-Line

To run a single load test from the command-line

  1. Open a Visual Studio command prompt.

    To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 2010 Command Prompt.

    By default, the Visual Studio command prompt opens to the following folder:

    <drive letter>:\Program Files\Microsoft Visual Studio 10.0\VC

    Note

    To change the folder to which the command prompt window opens by default, click Start, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, right-click Visual Studio 2010 Command Prompt, and then click Properties. In the Visual Studio 2010 Command Prompt Properties dialog box, you can change the path to the default folder in the Start in box.

  2. Locate the folder that contains your load test.

  3. To run a single load test from the command-line you need to specify the /TestContainer argument. A .webtest file or .loadtest file is considered a test container and a dll which contains unit tests is also a test container. For example, If you have a load test called LoadTest1.loadtest, you would use the following command to run the load test:

    mstest /TestContainer:LoadTest1.loadtest

Running Multiple Load Tests from the Command-Line

To run a multiple load tests from the command-line

  1. Open a Visual Studio command prompt.

    To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 2010 Command Prompt.

    By default, the Visual Studio command prompt opens to the following folder:

    <drive letter>:\Program Files\Microsoft Visual Studio 10.0\VC

    Note

    To change the folder to which the command prompt window opens by default, click Start, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, right-click Visual Studio 2010 Command Prompt, and then click Properties. In the Visual Studio 2010 Command Prompt Properties dialog box, you can change the path to the default folder in the Start in box.

  2. Locate the folder that contains your load test.

  3. You can specify multiple test container arguments from the command-line. If you want to execute LoadTest1.loadtest and LoadTest2.loadtest, use the following command-line:

    mstest /TestContainer:LoadTest1.loadtest /TestContainer:LoadTest2.loadtest

Running a Distributed Load Test from the Command-Line Using a Test Controller and Test Agents

To run a distributed load test using test controller and agents from the command-line

  1. Open a Visual Studio command prompt.

    To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 2010 Command Prompt.

    By default, the Visual Studio command prompt opens to the following folder:

    <drive letter>:\Program Files\Microsoft Visual Studio 10.0\VC

    Note

    To change the folder to which the command prompt window opens by default, click Start, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, right-click Visual Studio 2010 Command Prompt, and then click Properties. In the Visual Studio 2010 Command Prompt Properties dialog box, you can change the path to the default folder in the Start in box.

  2. Locate the folder that contains your load test.

  3. To run the load test using a test setting, type the following command:

    Mstest /TestContainer:LoadTest1.loadtest /testsettings:RemoteComputer.Testsettings

    Note

    To run a load test on a test controller and test agents you need to use a test setting that was created by using Visual Studio Ultimate. For more information, see Setting Up Machines and Collecting Diagnostic Information Using Test Settings.

Specifying the results file name

To specify the results file name when running a load test from the command-line

  1. Open a Visual Studio command prompt.

    To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 2010 Command Prompt.

    By default, the Visual Studio command prompt opens to the following folder:

    <drive letter>:\Program Files\Microsoft Visual Studio 10.0\VC

    Note

    To change the folder to which the command prompt window opens by default, click Start, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, right-click Visual Studio 2010 Command Prompt, and then click Properties. In the Visual Studio 2010 Command Prompt Properties dialog box, you can change the path to the default folder in the Start in box.

  2. Locate the folder that contains your load test.

  3. To run a load test and specify the name of the results file and where it is generated, use the /resultsfile parameter:

    mstest /TestContainer:LoadTest1.loadtest /resultsfile:c:\results\MyResults.trx

See Also

Tasks

How to: Run a Web Performance Test from the Command Line

How to: Run a Load Test Using Test Controllers and Test Agents Specified in a Test Setting

How to: Configure and Run Scheduled Tests After Building Your Application

Concepts

Running Load Tests

Running Automated Tests from the Command Line

Other Resources

Analyzing Load Test Runs