Export (0) Print
Expand All

How to: Run a Load Test from the Command Line

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.

Requirements

  • Visual Studio Ultimate

To run a single load test from the command-line

  1. Open a Visual Studio command prompt.

    To do this, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

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

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

    Note Note

    To change the folder to which the command prompt window opens by default, choose Start, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, right-click Developer Command Prompt, and then choose Properties. In the Developer 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

To run a multiple load tests from the command-line

  1. Open a Visual Studio command prompt.

    To do this, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

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

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

    Note Note

    To change the folder to which the command prompt window opens by default, choose Start, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, right-click Developer Command Prompt, and then choose Properties. In the Developer 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

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, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

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

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

    Note Note

    To change the folder to which the command prompt window opens by default, choose Start, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, right-click Developer Command Prompt, and then choose Properties. In the Developer 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 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.

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, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

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

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

    Note Note

    To change the folder to which the command prompt window opens by default, choose Start, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, right-click Developer Command Prompt, and then choose Properties. In the Developer 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

Show:
© 2014 Microsoft