Share via


Specifying a Load Model

You use load modeling options to more accurately predict the expected real-world usage of a Web site or application that you are load-testing. It is important to do this because a load test that is not based on an accurate load model can generate misleading results.

In Visual Studio Team System 2008 Test Edition, the following options were added to the load test feature to let you more easily create accurate load models:

  • Enhancements to the test mix model.

  • The Test Iterations property.

  • Initialize and terminate tests.

Test Mix Model Enhancements

Using the load test editor or the test mix model wizard, you can specify the following types of test mix for a load test scenario:

  • Test mix percentage based on the number of tests started. For more information, see Percentage Based on Tests Started.

  • Test mix percentage based on the number of virtual users who start tests. For more information, see Percentage based on virtual users.

  • Test mix based on user pace. For more information, see Pacing test mix.

    Note

    When do you choose Percentage test mix and when do you choose Percentage based on virtual users? The difference between these two choices is important when some tests in the test mix have a much longer duration than other tests. In this situation, you should probably choose Percentage based on virtual users. This choice helps avoid a test run in which the probability increases that too many users will be running long-duration tests. However, if the tests all have similar durations, you can more safely choose Percentage test mix.

Percentage Based on Tests Started

Determines which test in the test mix is run when a virtual user starts a test iteration. At the end of the load test, the number of times that a particular test was run matches the assigned test distribution. Use this test mix model when you are basing the test mix on transaction percentages in an IIS log or in production data. For each test in the mix, you can specify a percentage that determines how often the test is selected as the next test to run. For example, you might assign the following percentage values to three tests:

  • TestA (50%)

  • TestB (35%)

  • TestC (15%)

If you use this setting, the next test to start is based on the assigned percentages. This is done without taking into consideration the number of virtual users who are currently running each test.

Percentage Based on Virtual Users

This model of test mix determines the percentage of virtual users who will run a particular test. If you use this model of test mix, the next test to start is based not only on the assigned percentages but also on the percentage of virtual users who are currently running a particular test. At any point in the load test, the number of users who are running a particular test matches the assigned distribution as closely as possible.

Pacing Test Mix

If you specify a pacing test mix, you set a rate of test execution for each virtual user for each test in the test mix. For each test, this rate is expressed as tests run per virtual user per hour. For example, you might assign the following pacing test mix to the following tests:

  • TestA: 4 tests per user per hour

  • TestB: 2 tests per user per hour

  • TestC: 0.125 tests per user per hour

If you use the pacing test mix model, the load test runtime engine guarantees that the actual rate at which tests are started is less than or equal to the specified rate. If the tests run too long for the assigned number to be completed, an error is returned.

The "Think Time Between Test Iterations" setting does not apply when you use a pacing test mix, so it is not displayed as a property on the scenario. Rather, it is a property on the Percentage Test Mix.

Test Iterations Property

In the Run Settings properties, you can specify a value for the Test Iterations property. This value is the number of test iterations to run in a load test. Once the specified number of test iterations has been started, no additional test iterations will be started despite the settings of any of the load profiles. Once the number of test iterations specified has been completed, the load test ends.

Initialize and Terminate Tests

You can select tests to run at the beginning and end of each virtual user's load testing session. To do this, right-click the Test Mix container and then click Edit Test Mix to display the Edit Test Mix dialog box. Then, specify these tests under Initialize and terminate tests.

  • Initialize test. This test is run by each virtual user before any of the tests in the test mix are run.

  • Terminate test. This test is run after all tests for a particular virtual user are run.

Please note the following about the initialize test and the terminate test:

  • You can specify the load test duration by time rather than by iteration count. In this case, when the load test run duration has completed, the terminate test will not be run.

  • If the initialize test is a unit test or a Web test, the state of the TestContext, or WebTestContext, object after the completion of the initialize test is saved. It will then be used as the starting context for iterations of tests in the test mix.

  • New Users, as defined in the scenario property Percentage of New Users, always execute the initialize test, one iteration of a test from the test mix, and the terminate test.

See Also

Tasks

How to: Launch the Load Test Wizard

How to: Specify Load Patterns

How to: Specify Test Mix

How to: Specify Run Settings