8 min read

Editing load tests

The load can contain one or more scenarios for testing. The scenarios can be edited any time during the design. To edit a scenario, select the scenario you want to edit and right-click to edit the test mix, browser mix, or network mix in the existing scenario or add a new scenario to the load test. The context menu has different options for editing as shown here:

visualstudio2008-01

The Add Scenario… will open the same wizard, which we used before adding the scenario to the load test. We can keep adding the scenarios as much as we need. The scenario properties window also helps us modify some properties such as the Think Profile and the Think Time Between Test Iteration and the scenario Name.

visualstudio2008-02

The Add Tests… option is used for adding more tests to the test mix from the tests list in the project. We can add as many tests as required to be part of the test mix.

The Edit Test Mix… option is used for editing the test mix in the selected scenario. This option will open a dialog with the selected tests and distribution.

visualstudio2008-03

Using this Edit Test Mix window we can:

  • Change the test mix model listed in the drop–down.
  • Add new tests to the list and modify the distribution percentage.
  • Select an initial test that executes before other tests for each virtual server. The browse option next to it opens a dialog showing all the tests from the project from which we can select the initial test.
  • Similar to the initial test, we can choose a test which is the final test to run during the test execution. The same option is used here to select the test from the list of available tests.

The Edit Browser Mix… option opens the Edit Browser Mix dialog from where you can select the new browser to be included to the browser mix and delete or change the existing browsers selected in the mix.

The Edit Network Mix… option opens the Edit Network Mix dialog from where you can add new browsers to the list and modify the distribution percentages. We can change or delete the existing network mix.

For changing the existing load pattern, select the Load Pattern under the Scenarios and open the Properties window which shows the current patterns properties. You can change or choose any pattern from the available patterns in the list as shown in the following screenshots:

visualstudio2008-04

visualstudio2008-05

visualstudio2008-06

The Run Settings can be multiple for the load tests, but at any time only one can be active. To make the run settings active, select Run Settings, right-click and select Set as Active. The properties of the run settings can be modified directly using the properties window. The properties that can be modified include results storage, SQL tracing, test iterations, timings, and the web test connections.

visualstudio2008-07

Adding context parameters

The web tests can have context parameters added to them. The context parameter is used in place of the common values of multiple requests in the web test. For example, every request has the same web server name, which can be replaced by the context parameters. So whenever the web server changes, we can just change the context parameter value, which replaces all the requests with the new server name.

We know that the load test can have web tests and unit tests in the list. If there is a change in the web server for the load test other than what we used for web tests then we will end up modifying the context parameter values in all the web tests used in the load tests. Instead of this, we can include another context parameter in the load test with the same name used in the web tests. The context parameter added to the load test will override the same context parameter used in the web tests. To add new context parameter to the load test, select the Run Settings and right-click to choose the Add Context Parameter option, which adds a new context parameter. For example, the context parameter used in the web test has the web server value as

this.Context.Add("WebServer1", "http://localhost:49459");

Now to overwrite this in load tests, add a new context parameter with the same name as shown below:

visualstudio2008-08

Results store

All information collected during the load test run is stored in the central result store. The load test results store contains the data collected by the performance counters and the violation information and errors that occurred during the load test. The result store is the SQL server database created using the script loadtestresultsrepository.sql, which contains all the SQL queries to create the objects required for the result store.

If there are no controllers involved in the test and if it is the local test, we can create the results store sql database using SQL Express. Running the script creates the store using SQL Express. Running this script once on the local machine is enough for creating the result store. This is a global central store for all the load tests in the local machine. To create the store, open the visual studio command prompt and run the command with the actual drive where you have installed the visual studio.

cd c:Program FilesMicrosoft Visual Studio 9.0Common7IDE

In the same folder, run the following command which creates the database store

SQLCMD /S localhostsqlexpress /i loadtestresultsrepository.sql

If you have any other SQL Server and if you want to use that to have the result store then you can run the script on that server and use that server in connection parameters for the load test. For example, if you have the SQL Server name as SQLServer1 and if the result store has to be created in that store, then run the command as below:

SQLCMD /S SQLServer1 -U <user name> -P <password> -i
loadtestresultsrepository.sql

All these commands create the result store database in the SQL Server. If you look at the tables created in the store, it would look like this:

visualstudio2008-09

If you are using a controller for the load tests, the installation of the controller itself takes care of creating the results store on the controller machine. The controller can be installed using the Visual Studio 2008 Team Test Load agent Product.

To connect to the SQL Server result store database, select the Test option from the Visual Studio IDE and then select the Administer Test Controller window. This option would be available only in the controller machine. If the result store is on a different machine or the controller machine, select the controller from the list or select <Local-No controller>, if it is in the local machine without any controller. Then select the Load Test Results store using the browse button and close the Administer test Controller window.

The controllers are used for administering the agent computers and these controller and agents form the rig. Multiple agents are required to simulate a large number of loads from different locations. All the performance data collected from all these agents are saved at the central result store at the controller or any global store configured at the controller.

Running the load test

Load tests are run like any other test in Visual Studio. Visual Studio also provides multiple options for running the load test.

One is through the Test View window where all the tests are listed. We can select the load test, right-click and choose the option Run Selection option, which starts the load tests to run.

The second option is to use the Test List Editor. Select the load test from the test list in the test lists editor and choose the option to run the selected tests from the test list editor toolbar.

The third option is the built-in run option in the load test editor toolbar. Select the load test from the project and open the load test. This opens the load test in the load test editor. The toolbar for this load test editor has the option to run the currently opened load test.

The fourth option is through the command line command. MS Test command line utility is used for running the test. This utility is installed along with the Visual Studio Team System for Test. Open the Visual Studio command prompt. From the folder where the load test resides, run the following command to start the load test

mstest /testcontainer:LoadTest1.loadtest

In all the above cases, the load test editor will show the progress during the test run. But the other option does not show the progress instead stores the result to the result store repository. It can be loaded later to see the test result and analyze it. You can follow these steps to open the last run tests:

  1. Open the menu option Test | Windows | Test Runs.
  2. From the Connect drop-down, select the location for the test results store. On selecting this, you can see the trace files of the last run tests getting loaded in the window.
  3. Select the test run name from the list and double-click to open the test results for the selected run.
  4. Double-click the test result shown in the Results window that connects to the store repository, fetches the data for the selected test result, and presents in the load test window.

The end result of the load test editor window will look like the one shown in the following screenshot with all the performance counter values and the violation points.

visualstudio2008-10

More details about the graph are given under the Graphical View subsection.

LEAVE A REPLY

Please enter your comment!
Please enter your name here