Service Virtualization - SV Lab

UFT Developer integrates with Service Virtualization (SV), enabling you to test your web and mobile applications in various scenarios, even if the web services or remote devices they use are not ready, or you need to test conditions that are currently unavailable.

Note: This topic is aimed at people familiar with service virtualization and the use of SV Lab. If you are new to SV and would like to learn more, we recommend that you visit the Service Virtualization Help Center.


To use the SV integration in UFT Developer, you must have Java 1.8 installed.

After installing and enabling the integration, you can use SV when designing or running web or mobile tests.

If UFT Mobile - Service Virtualization Lab integration is set up, you can use Service Virtualization when running UFT Developer tests on mobile devices as well.

Install Service Virtualization with UFT Developer

UFT Developer 2021 The UFT Developer installation includes an on-premises installation of the Service Virtualization Lab.
UFT Developer 2021 R1 or later

To include the Service Virtualization Lab installation in your UFT Developer installation

  1. Download the standalone UFT Developer Service Virtualization Pack.

  2. Windows OS: Place the downloaded file in the same location as the UFT Developer .msi file.

    When installing UFT Developer, or modifying the UFT Developer installation, you can specify that the Service Virtualization feature be included in the installation.

    Mac or Linux: Unpack the file you downloaded and copy the files within it to the relevant locations under your UFT Developer installation. Contact Micro Focus support for details.

Enable Service Virtualization in UFT Developer

Add or edit the sv definition in the UFT Developer config.json file. See the bold text added below.

    "port": 5095,
    "maxLicensesAllowed": 1,
    "usageTracking": false,
           "enabled": true


Back to top

Configure the SV Lab license server URL

Configure the URL of an SV license server to enable simulating scenarios on more than 3 endpoints at a time.

Do one of the following: 

  • In the file <UFT Developer installation>\sv\conf\, add or edit the SVLicenseServerUrl property to define the SV license server address and port.

  • Define the SV license server address and port in the SVLicenseServerUrl Java System property.

Back to top

Configure SV's communication ports

The SV integration is based on the following flow:

When you open an application in your browser, the browser first connects to the SV Lab server, which, in turn, connects to the web application. This enables SV to simulate services that the application requires.

Perform the configuration steps below to enable the SV communication flow

  • SV proxy address. The proxy for browsers to use when using SV.

    By default, SV uses the proxy address: localhost:9000.

    To configure a different port number, add an inProxyPort number definition in the "sv" section that you added to the config file.

  • outProxy address. If your network requires a proxy to access the Internet, you must configure the proxy address for SV to use when accessing your application.

    Add an outProxy string definition in the "sv" section that you added to the config file.


               "enabled": true,
    	    "inProxyPort": 7777,
    	    "outProxy": ""
  • Additional ports used by SV integration: 

    UFT Developer uses the following additional ports when working with SV:

    uiPort. The internal listening port used by the service hosting the SV user interface.

    labPort. The listening port used by the SV user interface to start discovery, learning, and simulation.

    By default, these port numbers are randomly generated and change each time the UFT Developer runtime engine starts.

    If you want UFT Developer to use specific ports for this use, define them in the config file in the same was you defined the inProxyPort and the outProxy.

  • Configure your web browser to use the SV proxy address.

    This step is required to test applications running in your web browser. If you are testing applications running on a mobile device, you can skip this configuration.

    To enable SV to intervene when you open an application in your browser, you must configure the browser to use the SV proxy address localhost:9000, or localhost:<configured inProxyPort number>.

    To use SV when designing UFT Developer tests in your IDE, you must configure your browser proxy manually.

    To use SV when running a UFT Developer test, you can do this programmatically, as described further below.


    • After setting this proxy, if you use your browser when SV is not running, the browser will not be able to reach any URLs.

    • Keep in mind that Internet Explorer proxy definitions affect other programs on your computer as well. Some steps you may need to take to mitigate this:

      Select Bypass proxy server for local addresses in the browser's proxy server definitions.

      Add UFT Developer's concurrent license server address to the list of addresses that should not use the proxy.

      Change your eclipse proxy definitions to use the Manual Active Provider option instead of the Native one.

Config file location


%localappdata%\LeanFT\config\. If this folder does not exist, create it.

Linux ~/.leanft/config
Mac ~/Library/Application Support/LeanFT/config

Note: If this is your first time editing the configuration file, the config folder will be empty. You need to copy the file from:<UFT Developer installation>/lwe/lightweight-engine/config

Back to top

Use SV when designing UFT Developer tests in your IDE

Start SV from the UFT Developer Eclipse or IntelliJ IDEA plug-in and do the following: 

  • Discover all of the endpoints that your application communicates with.
  • Learn the details of the scenarios you want to simulate.
  • Simulate the relevant scenarios.

To use SV during UFT Developer test design

  1. SV Prerequisites:

  2. Prerequisites for working with SV on mobile devices:

  3. Make sure the UFT Developer runtime engine is running. For details, see Start/Stop the runtime engine.

  4. In Eclipse or IntelliJ IDEA, select UFT Developer  > Launch Service Virtualization.

    The Service Virtualization window opens with the DESKTOP tab selected. Use this tab for non-mobile applications.


    • If you don't see anything open, check if the Service Virtualization tab in your IDE window is minimized.

    • If Service Virtualization does not start, you may need to disable UFT Developer from the IDE UFT Developer menu and enable it again, for all configuration changes to take effect.

  5. To use Service Virtualization on a mobile device, open the device. This adds a Mobile tab to the Service Virtualization window:

    1. On your IDE toolbar, click UFT DeveloperLaunch UFT Mobile Device.

    2. On the UFT Mobile window, locate the required device. Use the filters in the Filter pane or use the search capability. For more information on finding a device, see Finding specific devices.

    3. Click the device you want, and then click the check mark on the right.

    A MOBILE tab is added to the Service Virtualization window, near the DESKTOP tab in the upper right corner. This tab remains visible as long as the UFT Mobile window displaying your device is open.

    Select the Mobile tab and perform the following Discover, Learn, and Simulate steps on this tab.

  6. Discover the endpoints your application uses.

    1. In the DISCOVER tab, click DISCOVER and wait for confirmation that the discovery is running.
    2. In a browser window, navigate to your web application and perform some steps on it, so SV can discover the endpoints the application uses.

      Tip: If you change the config file at this point, you need to restart the UFT Developer runtime engine and re-open Service Virtualization.

    3. In the Service Virtualization window, click Stop and view the discovered list of endpoints.

    4. You can manually add additional endpoints that you know the application uses but were not discovered during the set of steps you ran on the application.

  7. Learn which data is transmitted through the endpoints.

    1. In the LEARN tab, in the list of endpoints, select the ones you want to simulate.

      Select the Bluetooth endpoint to learn Bluetooth activities of the application you are testing.

    2. Enter a name for the scenario you want to create, click LEARN, and wait for confirmation that the learning is running.

      By default, the scenario files are saved in %localappdata%\LeanFT\sv-scenarios\ (on Windows).

      You can change this location by adding a scenariosFolder string definition in the "sv" section that you added to the config file.

    3. Clear your browser's cache to make sure it does not use local data for the next application session.

    4. Reload the application, and perform some steps to generate data on the endpoint.

    5. In the Service Virtualization window, click Stop.

    6. In the scenario path displayed in the LEARNING tab, open the .js file that contains the scenario data.

      Each scenario may contain multiple simulation files for multiple endpoints. Use the files named <endpoint name>Model.js

      You can change data in this file, specifying the data SV should use when simulating the relevant endpoint.

  8. Simulate a scenario the application uses.

    You can run the following steps a few times, with different data in the simulation file each time, and test that the application behaves accordingly.

    1. In the SIMULATION tab, select the scenario that you want to simulate, click SIMULATE, and wait for confirmation that the simulation is running.

      The Server Endpoint Address indicates the address of the SV Lab server that is providing the simulation services for this run.

      Note: You can create and store multiple scenarios. However, when running a simulation session, you can use only one scenario at a time.

    2. Clear your browser's cache to make sure it does not use local data for the next application session.

    3. Reload the application, and perform some steps that require the simulated scenario.

    4. Click Stop when you want to stop the simulation. For example, if you want to let the real endpoint handle the communication.

Note: When you close your IDE, Service Virtualization processes sometimes remain running on your computer. We recommend that you verify that all SV processes stopped and manually stop any remaining ones.

Back to top

Use SV Lab when running UFT Developer tests

To use service virtualization in UFT Developer Java tests, do the following:

  1. Include the SV Lab Client SDK sv-lab-client-all-5.1.0.jar file provided with the UFT Developer installation. The file is located in the <UFT Developer install>\SDK\Java\sv folder.

  2. Add the following import statements to your code: 

  3. Use the getSvInfo method to retrieve the address of the SV endpoint that is providing the simulation services for this run.

    For web testing in a Desktop environment, retrieve the SV web proxy address as well, and configure your web browser to use it.

    Perform the following steps: 

    Desktop environment Mobile device
    1. Use the UFT Developer Java SDK method Desktop.getSvInfo to retrieve the SV web proxy address and the address of the SV endpoint that is providing the simulation services for this run.

    2. Configure your web browser to use the SV web proxy, in one of the following ways:

      • Configure the browser manually as described above.

      • Configure the browser automatically in your test steps, providing the proxy information in your BrowserFactory.launch statement. For details, see the example below or the Java SDK.

    Running parallel tests

    When you run multiple tests in parallel, multiple SV Lab servers run in parallel. Each test communicates with one server, using the endpoint address retrieved by getSvInfo.

    In this case, do not define the inProxyPort in the config.json file. UFT Developer allocates an available port for the SV web proxy and returns it in getSvInfo. Use this proxy in BrowserFactory.launch step.

    1. Make sure Service Virtualization is set up and enabled on your device in UFT Mobile. For details, see the Service Virtualization Help Center.

    2. Use the UFT Developer Java SDK method Device.getSvInfo to retrieve the SV endpoint in UFT Mobile that is providing the simulation services for this run.

      Note: Device.getSvInfo always returns NULL for the SV web proxy address. UFT Developer does not need this information, as UFT Mobile manages the communication between the Mobile web browser and SV.

  4. Use the SV Lab Client SDK to start and stop simulation during your test run, using the address of the SV endpoint and scenarios that you prepared in advance.

    • For details on how to customize simulations, see the Service Virtualization Help Center - SV Lab.
    • For details on the SV Lab Client SDK, see the API documentation available in <UFT Developer install>\SDK\Java\sv\sv-lab-client-<version number>-javadoc.jar. (Unzip the file and open index.html)

Back to top

Examples - UFT Developer tests with Service Virtualization

The following examples show a UFT Developer test written in Java, which use Service Virtualization.

You can see the imported packages, the call to Desktop.getSvInfo() or Device.getSvInfo(), and the subsequent calls to the SV Lab Client methods: newInstance(inf.getEndpoint()), loadActiveVirtualLab, startActiveVirtualLab, runSimulation, stopSimulation, and stopActiveVirtualLab.

In the Desktop example, you can also see the BrowserFactory.launch method, which specifies the SV web proxy address for the browser to use.

Back to top

Running UFT Developer-SV tests created in earlier versions

Each new version of UFT Developer uses a newer version of the SV Lab. To run tests that use SV and were created in earlier versions of UFT Developer or in LeanFT, you need to perform the following steps:

  • Replace the sv-lab-client-<version>.jar file included in your project with sv-lab-client-<version>.jar, located in <UFT Developer installation>\SDK\Java\sv.

  • Tests created in LeanFT 14.52: In calls to the method SvClient.loadActiveVirtualLab, add the new required boolean argument forceDeploy. This argument defines whether to undeploy an existing lab with the same ID if such exists.

    Use 'true' to preserve the behavior that you had in LeanFT 14.52.

Back to top

See also: