Use Service Virtualization (on-premises)

UFT Mobile's integration with Service Virtualization (SV) supports testing through UFT Developer or Appium tests. This topic describes how to use Service Virtualization for testing a mobile app with UFT Developer. This section is relevant only for on-premises deployments of UFT Mobile.

Enable SV Simulation

The following steps describe how to use service virtualization with UFT Developer and UFT Mobile:

  1. Before working with SV, make sure that you have set up UFT Mobile for service virtualization. For details, see Set up Service Virtualization (on-premises)
  2. Enable SV in the LeanFT config.json file. If needed, configure the SV proxy and outbound proxy address:
    • SV proxy address. By default, SV uses the proxy address: localhost: 9000. To configure a different port number, add an inProxyPort number definition in the "sv" section of the config file.
    • outProxy address. If your network requires a proxy to access the Internet, add an outProxy string definition in the "sv" section of the config file


  "port": 5095,
  "maxLicensesAllowed": 1,
  "usageTracking": false,
  "sv":	{
    "enabled": true,
    "inProxyPort": 7777,
    "outProxy": ""

Back to top

Learn the back-end service

Discover the endpoints

  1. In your IDE, select UFT Developer > Launch a UFT Mobile Device. Select a device that you have enabled for SV (it should have the SV icon in the right-hand corner) and then click the check mark on the right.
  2. In your IDE, select UFT Developer >Launch Service Virtualization to open the Service Virtualization window.
  3. In the DISCOVERY tab, select Mobile in the top-right, and click DISCOVER. Wait for confirmation that the discovery is running.
  4. On the remote device screen viewer, open the packaged version of your app for testing. The endpoint discovered by SV are displayed in the SV window.
  5. In the Service Virtualization window, click Stop and view the discovered list of endpoints.

Learn the scenario

  1. In the LEARNING tab, in the list of endpoints, select the ones you want to simulate.
  2. Enter a name for the scenario you want to create, click LEARN, and wait for confirmation that the learning is running.
  3. Go back to the application in the remote device screen viewer, and refresh the app or perform some steps to generate data on the endpoint.
  4. In the Service Virtualization window, click Stop.
  5. The learning session generates a set of files for the scenario, saved to the path that you specified.

Back to top

Run a test with the simulated scenario

Extend your UFT Developer test by including the simulation model generated during the SV learning:

  • Add the following import statements to your code:
  • Use the .getSvInfo() method to retrieve the address of the SV endpoint that is providing the simulation services for the run. Use the SV Lab Client SDK to load the lab using the address of the SV endpoint and scenarios that you recorded, and to run the simulation as follows:

//import SV libraries

//Create SV client pointing to  the endpoint 
sv = SvClient.newInstance(device.getSvInfo().getEndpoint());

// Load a module to the server to create a lab and start it
sv.loadActiveVirtualLab("classpath:/sv-lab.json", sv.compileModuleFromSources("classpath:/<recorded SV scenario files folder>/*"), true);

//When the test case starts, start simulation of scenario
sv.runSimulation("<Scenario Name");

//Stop simulation and lab

For a runnable demo project, see SV integration on the git repository.

For more details on using Service Virtualization with UFT Developer, see the UFT Developer Help Center.