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, 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:
- If Service Virtualization is not installed in your LoadRunner environment, download it from the Service Virtualization site (free trial available). After installation, see the Service Virtualization Help Center for setup information.
- Create your virtual services in Service Virtualization Designer. For details, see Virtual Services in the Service Virtualization Help Center.
- If you need a virtual service to be running while you record your script, open Service Virtualization and start the virtual service before recording.
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.
You have a .NET desktop application that calls a Web service, whose URL is set using a constant:
stringURL = http://microfocus.com
You have a service or back-end component that uses the Web service, and the URL is configured in the app.config file.
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.
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:
- Define a manual scenario (see How to Design a Manual Scenario) or a goal-orientated scenario (see How to Design a Goal-Oriented Scenario).
- In the Design tab, click the Service Virtualization button .
- In the Service Virtualization Setup Dialog Box, click the Add Services button.
In the displayed Add New Services dialog box, add projects and services:
- Select a source from which to load the services—Project or Running Server.
- For Project, browse to the project containing the simulated services you want to run with your load test.
- For Running Server, specify the URL of the server hosting Service Virtualization.
- Click Next. If your project or service requires authentication or decryption, you are prompted to provide the details.
- 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 Integration.
- In the Service Virtualization Setup dialog box, select the check box adjacent to each virtual service you want to run.
- 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.
- For each selected service, select the relevant Data Model and Performance Model information to associate with the virtual service.
- For each selected service, select a Mode, or use the Stand-By or Simulation options to set the mode for all selected services.
- Click Save Setup to save your changes.
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:
- Run the scenario. For details, see How to Run a Scenario.
- 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.
- 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.
- Monitor virtual service behavior using the online monitors. For details, see Service Virtualization Monitors.