Use virtual services in a scenario

This topic describes how to incorporate virtual services into your load test scenario, so that you can run tests with virtual services instead of actual services.

Prepare the environment

In order to work with virtual services in LoadRunner Professional, you must first install Service Virtualization and define the virtual services you need. You may also need to perform some configuration for the application that you are testing.

To prepare the environment:

  1. If Service Virtualization is not installed in your LoadRunner Professional environment, download it from the Service Virtualization site (free trial available). After installation, see the Service Virtualization Help Center for setup information.
  2. Create your virtual services in Service Virtualization Designer. For details, see Virtual Services in the Service Virtualization Help Center.
  3. If you need a virtual service to be running while you record your script, open Service Virtualization and start the virtual service before recording.
  4. If the application under test has embedded components in the code or configuration files, referring to the web service, update them to point to the virtual service URL in place of the actual service.

    For example:

    • You have a .NET desktop application that calls a web service, whose URL is set using a constant:

      stringURL =

    • You have a service or back-end component that uses the web service, and the URL is configured in the app.config file.

  5. If both of the following apply for the application under test:

    • It is using services that are consumed by accessing UDDI or another registry component (Systinet).
    • The URL is retrieved during runtime.

    Then update the end point URL in UDDI/Systinet to point to the virtual service URL.

Back to top

Add virtual services to a scenario

The following steps describe how to work with Service Virtualization from within Controller, enabling you to incorporate virtual services into a load test scenario.

To add virtual services to a scenario:

  1. Define a manual scenario (see Design a manual scenario) or a goal-orientated scenario (see Design a goal-oriented scenario).
  2. In the Design tab, click the Service Virtualization button .
  3. In the Service Virtualization Setup dialog box, click the Add Services button.
  4. In the displayed Add New Services dialog box, add projects and services:

    1. Select a source from which to load the services—Project or Running Server.
    2. For Project, browse to the project containing the simulated services you want to run with your load test.
    3. For Running Server, specify the URL of the server hosting Service Virtualization.
    4. Click Next. If your project or service requires authentication or decryption, you are prompted to provide the details.
    5. Click Next. After a short wait, the project and its corresponding services are displayed in the Service Virtualization Setup dialog box.

    Note: A service cannot be deployed when it is added from a running server, but you can switch the modes and deploy it at a later time, when it is no longer locked. For information on modes and locks, see Service Virtualization.

  5. In the Service Virtualization Setup dialog box, select the check box adjacent to each virtual service you want to run.
  6. Click the <project name> link for each relevant parent project, and verify that the address of the virtualization server is correct. If required, you can change the server address.
  7. For each selected service, select the relevant Data Model and Performance Model information to associate with the virtual service.
  8. For each selected service, select a Mode, or use the Stand-By or Simulation options to set the mode for all selected services.
  9. Click Save Setup to save your changes.
  10. Back to top

Manage and monitor virtual services during the test

During your load test run, you can control virtual service deployment. You can also view monitors, to analyze the status and performance of the simulated services during the test run.

To manage and monitor virtual services:

  1. Run the scenario. For details, see Run a scenario.
  2. Use the Service Virtualization Runtime dialog box to manage the virtual services. You can view information and problems related to the services, and use the toolbar links to control the services: Simulate, Stop, Unlock, Undeploy.
  3. To add or update a service during your load test, return to the Design tab and add a new service as described above, using the Service Virtualization Setup dialog box.
  4. Monitor virtual service behavior using the online monitors. For details, see Service Virtualization monitors.

Back to top

See also: