Performance & Load Testing Using Visual Studio Test Rig

Performance & Load Testing Using Visual Studio Test Rig

For the real-world “usual” scenario concerning the performance testing involving 90 to 100 users is easily possible, but the limitation we face here is that the respective resources eventually get occupied. Henceforth, it becomes cryptic in the “Exceptional” scenario where the capacities of the users are on a large scale (say: 10k, 20k…nk).

Well, in this scenario we tell machines to do our job because they can do routine work faster than a human can do or we add more resources to the machine so that it can perform those functions faster. A “Test Rig” network is meant for this purpose, i.e. to simulate large number of users through machines.

Visual Studio Test Rig can be used for running tests remotely, distribute tests across multiple machines, or run load tests. A Test Rig works as Master-Slave technology wherein “Test controller” is a Master and “Test Agents” are slaves.

  • A Controller as the name implies controls Agents who work as clients for generating loads). For generating load on remote computers, one must install a Test Controller utility and then configure it to communicate with Agents.
  •  An Agent is responsible for accepting the command from the controller and execute script or web requests in specific order and fashion.

Test agent and test controller interaction

The test controller manages a set of client machines (test agent) to run the tests. The test controller communicates with all the configured client machines (test agent) to start, stop, track test agent status and collect the test results.

Performance & Load Testing-Visual Studio Test Rig

 

Test controller

The test controller gives a general architecture for running tests and includes special features for running load tests. The test controller forwards the load test to all the agents and waits until all the test agents have initialized the test. When all test agents are ready, the test controller sends a message to the test agents to start the test.

Test agent

The test agent runs as a service that listens for requests from the test controller to start a new test. When the test agent gets a request, the test agent service starts a process on which to run the tests. Each test agent runs the same load test.

Test agents are assigned a weight by the user and load is distributed according to a test agent’s weighting. For example, if test agent-1 has a weighting of 60, and test agent-2 has a weighting of 140, and the load is set to 2000 users, then test agent-1 simulates 600 virtual users whereas test agent-2 simulates 1400 virtual users.

The test agent takes a set of tests and a set of simulation parameters as an input. A key concept is that tests are standalone of the computer where they’re run.

Even though a test controller typically manages several test agents, an agent can only be associated with a single controller.

This architecture makes it easy to increase the number of test agents, thereby generating larger loads.

You can download and install a test controller and agent from below URL.

https://visualstudio.microsoft.com/downloads/?q=agents

Configure Test Controller and Test Agent

Configuring Test Controller

  1. To configure the test controller that you have to installed, select Configure test controller now. Choose Test Controller Configuration Tool from the All Programs. The Configure Test Controller dialog box is displayed.Performance & Load Testing-Visual Studio Test Rig
  2.  Select the user to use as the logon account for your test controller service. Either select Local System or enter account name and password.
  3.  To configure your test controller for load testing, select Configure test controller for load testing.
  4. Type your SQL Server instance in Create load test results database in the following SQL Server instance.
  5. To apply your changes, choose Apply Settings. A Configuration summary dialog box is displayed. It shows the status of each step that is required to configure your test controller.Performance & Load Testing-Visual Studio Test Rig
  6. Choose Close, to close the Configuration summary dialog box. Then choose Close again to close the Configuration Test Controller Tool.

The Visual Studio Agents Setup dialog box is shown. From here, you can install any other components that you want on this computer.

Performance & Load Testing-Visual Studio Test Rig

Configure Test Agent

  1. To configure the test agent you must install, Test Agent Configuration tool. After the installation, run the agent configuration utility which will display Configure Test Agent dialog box.
  2. Choose Run Options.
  3. Under Run the test agent as a select Network Service.  Or choose another option.
  4. Enter credential (your local system) the user when the test agent starts as a service.
  5. Type the name in User name. Type the password in Password.

To register this agent with the test controller you must installed, select Register with the test controller. In Register, the test agent with the following test controller, type the name of the system you installed the test controller on and optionally follow it with a colon (:) and the configured system port number that you are using. For example, type Contoller1:6901.

Note: The default port number is 6901 unless changed explicitly.

Performance & Load Testing-Visual Studio Test Rig

 

  1. To apply changes, choose Apply Settings. A Configuration Summary Box is displayed. It shows the status of each step that is required to configure your Test Agent.
  2. To close the Configuration summary dialog box, choose Close. To close the Test Agent Configuration Tool.
  3. Once the agent configuration is complete, you must restart the computer where you set up the test agent.

Performance & Load Testing-Visual Studio Test Rig

Managing Test Controllers and Test Agents with Visual Studio

To manage a test controller and agents from a Visual studio, one must create a test setting file where these configurations are carried out.

To add a test set for a distributed load test

  1. Open Visual Studio and open performance testing project.
  2. If you do not have .testsettings file in the project folder, you can create .testsettings file.

i) In Solution Explorer, right-click Solution Items and then point to Add, and then choose New Item.

ii) The Add New Item dialog box appears.

iii) In the Installed Templates pane, choose Test Settings.

iv)In the Name box, type localtest. testsettings

v) Choose Add.

vi) That will add a new test local test. test settings file appears in Solution Explorer, under the Solution Items folder.

vii) The Test Settings dialog box is displayed with the default General tab opened. You can now edit and save test settings values.

viii. On the Roles page, select Remote execution.

Remote execution option is used where you do not want to run any part of your application locally. This is a typical configuration where the application requires platforms, such as a specific web browser or database. You can collect test data and configure the test environment on each machine.

Performance & Load Testing-Visual Studio Test Rig

In the Controller drop-down list, type the computer name of the test controller you created in the Setup a Test Controller procedure or select Manage Test Controller option. Manage Test Controller dialog box is displayed.

Performance & Load Testing-Visual Studio Test Rig

1. Select the Controller and configure the Load test results store

Performance & Load Testing-Visual Studio Test Rig

2. Choose Close in the Manage Test Controller dialog box and click on the Next button.

3. Choose Data and Diagnostics. The Data and Diagnostics page is displayed.

4. Under Role, verify that the Distributed load test role is selected.

5. Under Data and Diagnostic for the select role, select the IntelliTrace and System Information adapters.

6. To save the new test settings, choose Apply.

7. Choose Close

Preparing Load script file for load distribution and other configuration

In order to have a proper and better understanding of load distribution and to create load test profile, two scenarios are elucidated below.

For the first scenario which is related to a Police officer first the process of login is performed then after that get tags, navigate to the video page, search video by username and uploaded date, streaming videos, edit any video, share video by any users.

Performance & Load Testing-Visual Studio Test Rig

Performance & Load Testing-Visual Studio Test Rig

1. Go to Solution Explorer window (in visual studio tool), right-click and select Add >> Load Test.

Performance & Load Testing-Visual Studio Test Rig

2. When the load test wizard appears, choose the kind of load test that you would like to run. Select the On-Premises Load Test option and click on the Next.

Performance & Load Testing-Visual Studio Test Rig

3. The Run Settings for a load test allows you to specify how long the test should run using either time duration or a specific number of test iterations.

4. Enter a name for the load scenario like “Load_Distribution” but leave the default to think time profile in place.

5. Click the Next button to continue to the Load Pattern definition screen. Use the Constant load option (the default) or Step load option based on the test execution plan select option.

a.  Select the Next button to continue to the Test Mix Model definition screen.

b. Read the description of each test mix model and viewing the description that appears on the right-hand side. Select the Next button to continue to the Test Mix screen.

c. Select the Add button to load the Add Test window is displayed.

Performance & Load Testing-Visual Studio Test Rig

d.  Select Test Scenario script, SW_PoliceOfficer and SW_RMB from Available tests list box and click on > sign.

Performance & Load Testing-Visual Studio Test Rig

e. Based on the test plan, set the % Distribution on each scenario and click on Next

Performance & Load Testing-Visual Studio Test Rig

f. Load test will be ready as per the above configuration and click on run button.

Performance & Load Testing-Visual Studio Test Rig

Summary

Due to the growing competition and the demand of the industry Performance testing has become an important endeavor to focus. The basic methodology through which the load testing is performed effectively and efficiently includes: distributing the load, create and configure test rig network, identifying critical scenarios, load simulation, effective workload model, test script design with enhancements, collecting the performance metrics, and benchmarking & recommendations.