Export (0) Print
Expand All

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

To run a single web performance 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 web performance test.

  3. To run a single web performance 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 that contains unit tests is also a test container. For example, If you have a web performance test called WebTest1.webtest, you would use the following command to run the web test:

    mstest /TestContainer:WebTest1.webtest

  4. (Optional) You can use other options with the MSTest command. For example, you can save results to a specific test results file; publish test results; or run with a specific test setting to, for example, change the files that are deployed. For more information, see MSTest.exe Command-Line Options.

To run a multiple web performance 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 WebTest1.webtes and WebTest2.webtest, use the following command-line:

    mstest /TestContainer: WebTest1.webtest /TestContainer: WebTest2.webtest

One of the big differences with running tests from the command line is that you cannot take advantage of the automatic processes in Visual Studio Ultimate. When you run a web performance test from within Visual Studio Ultimate, Visual Studio tries to determine what needs to be deployed with the web performance test in order for the test to run. For example, if you have written a custom validation rule or a extraction rule. When you run the web performance test from within Visual Studio Ultimate, it will look at the references of the Web performance and load test project and try to figure out what needs to be deployed.

When you run tests from the command-line, you will need to be very explicit about what you deploy. For example, if you have a DLL that needs to be deployed for a web performance test to run, you will need run mstest and specify the /testsettings parameter. Test settings include deployment items. For more information, see Specifying Test Settings for Visual Studio Tests.

To run a web performance test from the command-line that specifies deployment items contained in a test setting

  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 web performance test.

  3. To run a web performance test with a test setting that includes deployment information, use mstest similar to the following:

    Mstest /TestContainer:WebTest1.webtest /TestSettings:NewOrEditedTestSetting.testsettings

When you use Visual Studio Ultimate to run a web performance or a load test on a test controller and test agents to distribute the test across multiple machines, you need to use a test setting. In Visual Studio Ultimate you can create or edit a test setting and specify to run a controller name. For more information, see Setting Up Machines and Collecting Diagnostic Information Using Test Settings.

When you run a web performance test from the command-line, you also need to create or use a test setting that has a test controller specified in it by using the mstest to specify the /testsettings parameter.

To run a web performance test from the command-line that includes a test controller and test agents for distributed testing specified in a test setting

  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 web performance test.

  3. To run a web performance test with a test setting that includes a test controller and test agent, use mstest, similar to the following:

    Mstest /TestContainer:WebTest1.webtest /TestSettings:NewOrEditedTestSetting.testsettings

You can run a coded web performance test using mstest with the /testcontainer argument set to the DLL name that contains the coded test.

To run one or more coded web performance test contained in a DLL

  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 web performance test.

  3. Run a coded web performance test. Use mstest with the /testcontainer argument set to the DLL name that contains the coded test:

    mstest /TestContainer:TestProject1.dll

    When you specify a DLL for the test container, mstest will execute all of the tests within the DLL. If you want to execute just one test within a DLL, you can use the /test argument. For example, to run WebTest1Coded contained in a DLL, you can use the following command line:

    mstest /TestContainer:TestProject1.dll /Test:WebTest1Coded

    If you wanted to execute two web performance tests, you can specify multiple /Test arguments:

    mstest /TestContainer:TestProject1.dll /Test:WebTest1Coded /Test:WebTest2Coded

Results file (.trx file) are saved using a unique name that contains user, machine and a timestamp. If you want to specify the name of the results file and where it is generated, you can use mstest with the /resultsfile parameter.

To run specify the results file name when you run a web performance 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 web performance test.

  3. Run a coded web performance test. Specify the name of the results file and where it is generated using mstest with the /resultsfile parameter:

    mstest /TestContainer:WebTest1.webtest /resultsfile:c:\results\MyResults.trx

Show:
© 2014 Microsoft